1 define <export> {
2 SCREEN_SYNCH = 1
3 SCREEN_NOSYNCH = 0
4 SCREEN_SYNCHSAFE = 2
5 }
6
7 type TScreen <inherit = GAPI_Object>:
8 type TScreenMode {
9 int tWidth
10 int tHeight
11 int tDepth
12 int tRefreshRate
13 int tFrameRate
14 }
15
16 global {
17 TScreen Screen
18 arr SCREEN_MODES of TScreenMode
19 int GAPI_ScreenSynch
20 TScreenMode GAPI_ScreenMode
21 }
22
23 method int TScreen.GetFreeMem(){
24 return Screen_GetAvailableMemory()
25 }
26 property TScreen.Gamma(int RGB){
27 Screen_SetGamma(0,0,0,1)
28 Screen_SetGamma(RGB >> 16,RGB >> 8 & 0xFF,RGB & 0xFF,0)
29 }
30 method TScreen.setGamma(int RGB){
31 Screen_SetGamma(0,0,0,1)
32 Screen_SetGamma(RGB >> 16,RGB >> 8 & 0xFF,RGB & 0xFF,0)
33 }
34 method TScreen.setGamma(int R G B){
35 Screen_SetGamma(0,0,0,1)
36 Screen_SetGamma(R, G, B, 0)
37 }
38 method TScreen.Clear(int RGB){
39 Screen_Clear(RGB)
40 }
41 method TScreen.Clear(int R G B){
42 Screen_Clear((B<<16) + (G<<8) + R)
43 }
44 method TScreen.Close(){
45 Screen_Close()
46 }
47 method TScreen.CreateRGBFilter(int x y width height RGB){
48
49 }
50 method TScreen.CreateRGBFilter(int x y width height R G B){
51 Screen_DisplayRGBFilter(x,y,width,height,R,G,B)
52 }
53 method int TScreen.getDisplayModes(){
54 int i = 0
55 SCREEN_MODES.clear()
56 if Screen_ExamineScreenModes(){
57 while Screen_NextScreenMode(){
58 SCREEN_MODES.expand(1)
59 SCREEN_MODES[i].tWidth = Screen_GetWidth ()
60 SCREEN_MODES[i].tHeight = Screen_GetHeight()
61 SCREEN_MODES[i].tDepth = Screen_GetDepth ()
62 SCREEN_MODES[i].tRefreshRate = Screen_GetRefreshRate()
63 i++
64 }
65 return $true
66 }
67 return $false
68 }
69 method TScreen.FlipBuffers(){
70 Screen_FlipBuffers(GAPI_ScreenSynch)
71 }
72 method TScreen.FlipBuffers(int Synch){
73 GAPI_ScreenSynch = Synch
74 Screen_FlipBuffers(Synch)
75 }
76 property int TScreen.Synch{
77 return GAPI_ScreenSynch
78 }
79 property TScreen.Synch(int Synch){
80 GAPI_ScreenSynch = Synch
81 }
82 property int TScreen.Active{
83 return Screen_IsActive()
84 }
85 method int TScreen.Create(int width height depth){
86 GAPI_ScreenSynch = $SCREEN_SYNCH
87 GAPI_ScreenMode.tWidth = width
88 GAPI_ScreenMode.tHeight = height
89 GAPI_ScreenMode.tDepth = depth
90 return Screen_Create(width,height,depth,"".ptr())
91 }
92 method int TScreen.Create(int width height depth synch){
93 GAPI_ScreenSynch = synch
94 GAPI_ScreenMode.tWidth = width
95 GAPI_ScreenMode.tHeight = height
96 GAPI_ScreenMode.tDepth = depth
97 return Screen_Create(width,height,depth,"".ptr())
98 }
99 method int TScreen.Create(int width height depth synch, str Title){
100 GAPI_ScreenSynch = synch
101 GAPI_ScreenMode.tWidth = width
102 GAPI_ScreenMode.tHeight = height
103 GAPI_ScreenMode.tDepth = depth
104 return Screen_Create(width,height,depth,Title.ptr())
105 }
106 method int TScreen.CreateWindowed(int hwnd x y width height){
107 GAPI_ScreenSynch = $SCREEN_SYNCH
108 GAPI_ScreenMode.tWidth = width
109 GAPI_ScreenMode.tHeight = height
110 GAPI_ScreenMode.tDepth = 0
111 return Screen_CreateWindowed(hwnd,x,y,width,height,$true,0,0)
112 }
113 method int TScreen.CreateWindowed(int hwnd x y width height AutoStretch){
114 GAPI_ScreenSynch = $SCREEN_SYNCH
115 GAPI_ScreenMode.tWidth = width
116 GAPI_ScreenMode.tHeight = height
117 GAPI_ScreenMode.tDepth = 0
118 return Screen_CreateWindowed(hwnd,x,y,width,height,AutoStretch,0,0)
119 }
120 method int TScreen.CreateWindowed(int hwnd x y width height AutoStretch RightOffset BottomOffset){
121 GAPI_ScreenSynch = $SCREEN_SYNCH
122 GAPI_ScreenMode.tWidth = width
123 GAPI_ScreenMode.tHeight = height
124 GAPI_ScreenMode.tDepth = 0
125 return Screen_CreateWindowed(hwnd,x,y,width,height,AutoStretch,RightOffset,BottomOffset)
126 }
127 method int TScreen.CreateWindowed(int hwnd x y width height AutoStretch RightOffset BottomOffset Synch){
128 GAPI_ScreenSynch = Synch
129 GAPI_ScreenMode.tWidth = width
130 GAPI_ScreenMode.tHeight = height
131 GAPI_ScreenMode.tDepth = 0
132 return Screen_CreateWindowed(hwnd,x,y,width,height,AutoStretch,RightOffset,BottomOffset)
133 }
134 property int TScreen.Handle{
135 return Screen_GetHandle()
136 }
137 property TScreen.RefreshRate(int fps){
138 GAPI_ScreenMode.tRefreshRate = fps
139 Screen_SetRefreshRate(fps)
140 }
141 property int TScreen.RefreshRate{
142 return GAPI_ScreenMode.tRefreshRate
143 }
144 property TScreen.FrameRate(int fps){
145 GAPI_ScreenMode.tFrameRate = fps
146 Screen_SetFrameRate(fps)
147 }
148 property int TScreen.FrameRate{
149 return GAPI_ScreenMode.tFrameRate
150 }
151 property int TScreen.Canvas(){
152 return Screen_GetOutput()
153 }
154 method TScreen.StartFX(){
155 Screen_StartFX()
156 }
157 method TScreen.StopFX(){
158 Screen_StopFX()
159 }
160
161
162