summaryrefslogtreecommitdiff
path: root/Runtime/Export/UnityEngineDisplay.txt
blob: 67c871cdea5ba6a843b28e0ffbc6b5026afeac8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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 }