diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Export/UnityEngineDisplay.txt |
Diffstat (limited to 'Runtime/Export/UnityEngineDisplay.txt')
-rw-r--r-- | Runtime/Export/UnityEngineDisplay.txt | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/Runtime/Export/UnityEngineDisplay.txt b/Runtime/Export/UnityEngineDisplay.txt new file mode 100644 index 0000000..67c871c --- /dev/null +++ b/Runtime/Export/UnityEngineDisplay.txt @@ -0,0 +1,127 @@ +C++RAW + +#include "UnityPrefix.h" +#include "Configuration/UnityConfigure.h" +#include "Runtime/Scripting/ScriptingUtility.h" +#include "Runtime/Graphics/RenderTexture.h" +#include "Runtime/Graphics/DisplayManager.h" + +CSRAW +using System; +using System.Collections; + +namespace UnityEngine +{ +CLASS Display + + CSRAW + internal IntPtr nativeDisplay; + internal Display() { + #if UNITY_FLASH + this.nativeDisplay = new IntPtr(); + #else + this.nativeDisplay = new IntPtr(0); + #endif + } + internal Display(IntPtr nativeDisplay) { this.nativeDisplay = nativeDisplay; } + + CSRAW public int renderingWidth { get + { + int w=0, h=0; + GetRenderingExtImpl(nativeDisplay, out w, out h); + return w; + } + } + CSRAW public int renderingHeight { get + { + int w=0, h=0; + GetRenderingExtImpl(nativeDisplay, out w, out h); + return h; + } + } + + CSRAW public int systemWidth { get + { + int w=0, h=0; + GetSystemExtImpl(nativeDisplay, out w, out h); + return w; + } + } + CSRAW public int systemHeight { get + { + int w=0, h=0; + GetSystemExtImpl(nativeDisplay, out w, out h); + return h; + } + } + + CSRAW public RenderBuffer colorBuffer { get + { + RenderBuffer color, depth; + GetRenderingBuffersImpl(nativeDisplay, out color, out depth); + return color; + } + } + + CSRAW public RenderBuffer depthBuffer { get + { + RenderBuffer color, depth; + GetRenderingBuffersImpl(nativeDisplay, out color, out depth); + return depth; + } + } + + CSRAW public void SetRenderingResolution(int w, int h) + { + SetRenderingResolutionImpl(nativeDisplay, w, h); + } + + public static Display[] displays = new Display[1] { new Display() }; + + private static Display _mainDisplay = displays[0]; + public static Display main { get{return _mainDisplay;} } + + CSRAW private static void RecreateDisplayList(IntPtr[] nativeDisplay) + { + Display.displays = new Display[nativeDisplay.Length]; + for(int i = 0 ; i < nativeDisplay.Length ; ++i) + Display.displays[i] = new Display(nativeDisplay[i]); + + _mainDisplay = displays[0]; + } + + CSRAW private static void FireDisplaysUpdated() + { + if(onDisplaysUpdated != null) + onDisplaysUpdated(); + } + + CSRAW public delegate void DisplaysUpdatedDelegate(); + CSRAW public static event DisplaysUpdatedDelegate onDisplaysUpdated = null; + + + + CUSTOM private static void GetSystemExtImpl(IntPtr nativeDisplay, out int w, out int h) + { + UnityDisplayManager_DisplaySystemResolution(nativeDisplay,w,h); + } + + CUSTOM private static void GetRenderingExtImpl(IntPtr nativeDisplay, out int w, out int h) + { + UnityDisplayManager_DisplaySystemResolution(nativeDisplay,w,h); + } + + CUSTOM private static void GetRenderingBuffersImpl(IntPtr nativeDisplay, out RenderBuffer color, out RenderBuffer depth) + { + UnityDisplayManager_DisplayRenderingBuffers(nativeDisplay, &color->m_BufferPtr, &depth->m_BufferPtr); + } + + CUSTOM private static void SetRenderingResolutionImpl(IntPtr nativeDisplay, int w, int h) + { + UnityDisplayManager_SetRenderingResolution(nativeDisplay,w,h); + } + +END + +CSRAW } + |