Mercurial > sdl-ios-xcode
comparison src/video/photon/SDL_photon.c @ 3092:cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
From: "Mike Gorchak"
Subject: New QNX patches
In photon.tar.gz there are new files to be placed into ./src/video/photon/
directory.
qnx3.diff - new patches for QNX support. Since I've found a lot of bugs in
the new GF QNX Graphics Framework and I'm suspended development for GF
driver until already found bugs will be fixed and switched to Photon driver
implementation.
sdl.diff - I've found that renderer creation result has not been checked and
SDL shows error like: "there is no current renderer", now SDL will show
correct error which was set be renderer.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 17 Mar 2009 03:24:22 +0000 |
parents | 0b6f51c29267 |
children | aa1897bee1e9 |
comparison
equal
deleted
inserted
replaced
3091:32efcc94b3da | 3092:cad1aefa2ed9 |
---|---|
16 License along with this library; if not, write to the Free Software | 16 License along with this library; if not, write to the Free Software |
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18 | 18 |
19 Sam Lantinga | 19 Sam Lantinga |
20 slouken@libsdl.org | 20 slouken@libsdl.org |
21 | |
22 QNX Photon GUI SDL driver | |
23 Copyright (C) 2009 Mike Gorchak | |
24 (mike@malva.ua, lestat@i.com.ua) | |
21 */ | 25 */ |
22 | 26 |
23 #include "SDL_config.h" | 27 #include "SDL_config.h" |
24 | 28 |
25 #include "../SDL_sysvideo.h" | 29 #include "../SDL_sysvideo.h" |
30 #include "SDL_version.h" | |
31 #include "SDL_syswm.h" | |
32 | |
33 #include "../SDL_sysvideo.h" | |
34 | |
35 #include "SDL_photon.h" | |
26 | 36 |
27 static SDL_bool photon_initialized=SDL_FALSE; | 37 static SDL_bool photon_initialized=SDL_FALSE; |
28 | 38 |
29 static int photon_available(void) | 39 static int photon_available(void) |
30 { | 40 { |
54 { | 64 { |
55 } | 65 } |
56 | 66 |
57 static SDL_VideoDevice* photon_create(int devindex) | 67 static SDL_VideoDevice* photon_create(int devindex) |
58 { | 68 { |
69 SDL_VideoDevice* device; | |
70 SDL_VideoData* phdata; | |
71 int status; | |
72 | |
73 /* Check if photon could be initialized */ | |
74 status=photon_available(); | |
75 if (status==0) | |
76 { | |
77 /* Photon could not be used */ | |
78 return NULL; | |
79 } | |
80 | |
81 /* Initialize SDL_VideoDevice structure */ | |
82 device=(SDL_VideoDevice*)SDL_calloc(1, sizeof(SDL_VideoDevice)); | |
83 if (device==NULL) | |
84 { | |
85 SDL_OutOfMemory(); | |
86 return NULL; | |
87 } | |
88 | |
89 /* Initialize internal photon specific data */ | |
90 phdata=(SDL_VideoData*)SDL_calloc(1, sizeof(SDL_VideoData)); | |
91 if (phdata==NULL) | |
92 { | |
93 SDL_OutOfMemory(); | |
94 SDL_free(device); | |
95 return NULL; | |
96 } | |
97 device->driverdata=phdata; | |
98 | |
99 /* Setup amount of available displays and current display */ | |
100 device->num_displays=0; | |
101 device->current_display=0; | |
59 } | 102 } |
60 | 103 |
61 VideoBootStrap photon_bootstrap= | 104 VideoBootStrap photon_bootstrap= |
62 { | 105 { |
63 "photon", | 106 "photon", |
64 "SDL Photon video driver", | 107 "SDL QNX Photon video driver", |
65 photon_available, | 108 photon_available, |
66 photon_create | 109 photon_create |
67 }; | 110 }; |
68 | 111 |
112 /*****************************************************************************/ | |
113 /* SDL Video and Display initialization/handling functions */ | |
114 /*****************************************************************************/ | |
115 int photon_videoinit(_THIS) | |
116 { | |
117 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata; | |
118 | |
119 /* Check for environment variables which could override some SDL settings */ | |
120 // didata->custom_refresh=0; | |
121 // override = SDL_getenv("SDL_VIDEO_PHOTON_REFRESH_RATE"); | |
122 // if (override!=NULL) | |
123 // { | |
124 // if (SDL_sscanf(override, "%u", &didata->custom_refresh)!=1) | |
125 // { | |
126 // didata->custom_refresh=0; | |
127 // } | |
128 // } | |
129 | |
130 /* Add photon renderer to SDL */ | |
131 photon_addrenderdriver(_this); | |
132 | |
133 /* video has been initialized successfully */ | |
134 return 1; | |
135 } | |
136 | |
137 void photon_videoquit(_THIS) | |
138 { | |
139 SDL_DisplayData* didata; | |
140 uint32_t it; | |
141 | |
142 /* SDL will restore our desktop mode on exit */ | |
143 for(it=0; it<_this->num_displays; it++) | |
144 { | |
145 didata=_this->displays[it].driverdata; | |
146 } | |
147 } | |
148 | |
149 void photon_getdisplaymodes(_THIS) | |
150 { | |
151 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata; | |
152 SDL_DisplayMode mode; | |
153 | |
154 } | |
155 | |
156 int photon_setdisplaymode(_THIS, SDL_DisplayMode* mode) | |
157 { | |
158 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata; | |
159 | |
160 return 0; | |
161 } | |
162 | |
163 int photon_setdisplaypalette(_THIS, SDL_Palette* palette) | |
164 { | |
165 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata; | |
166 | |
167 /* Setting display palette operation has been failed */ | |
168 return -1; | |
169 } | |
170 | |
171 int photon_getdisplaypalette(_THIS, SDL_Palette* palette) | |
172 { | |
173 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata; | |
174 | |
175 /* Getting display palette operation has been failed */ | |
176 return -1; | |
177 } | |
178 | |
179 int photon_setdisplaygammaramp(_THIS, Uint16* ramp) | |
180 { | |
181 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata; | |
182 | |
183 /* Setting display gamma ramp operation has been failed */ | |
184 return -1; | |
185 } | |
186 | |
187 int photon_getdisplaygammaramp(_THIS, Uint16* ramp) | |
188 { | |
189 /* Getting display gamma ramp operation has been failed */ | |
190 return -1; | |
191 } | |
192 | |
193 int photon_createwindow(_THIS, SDL_Window* window) | |
194 { | |
195 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata; | |
196 SDL_WindowData* wdata; | |
197 | |
198 /* Allocate window internal data */ | |
199 wdata=(SDL_WindowData*)SDL_calloc(1, sizeof(SDL_WindowData)); | |
200 if (wdata==NULL) | |
201 { | |
202 SDL_OutOfMemory(); | |
203 return -1; | |
204 } | |
205 | |
206 /* Setup driver data for this window */ | |
207 window->driverdata=wdata; | |
208 | |
209 /* Check if window must support OpenGL ES rendering */ | |
210 if ((window->flags & SDL_WINDOW_OPENGL)==SDL_WINDOW_OPENGL) | |
211 { | |
212 /* Mark this window as OpenGL ES compatible */ | |
213 wdata->uses_gles=SDL_TRUE; | |
214 } | |
215 | |
216 /* Window has been successfully created */ | |
217 return 0; | |
218 } | |
219 | |
220 int photon_createwindowfrom(_THIS, SDL_Window* window, const void* data) | |
221 { | |
222 /* Failed to create window from another window */ | |
223 return -1; | |
224 } | |
225 | |
226 void photon_setwindowtitle(_THIS, SDL_Window* window) | |
227 { | |
228 } | |
229 | |
230 void photon_setwindowicon(_THIS, SDL_Window* window, SDL_Surface* icon) | |
231 { | |
232 } | |
233 | |
234 void photon_setwindowposition(_THIS, SDL_Window* window) | |
235 { | |
236 } | |
237 | |
238 void photon_setwindowsize(_THIS, SDL_Window* window) | |
239 { | |
240 } | |
241 | |
242 void photon_showwindow(_THIS, SDL_Window* window) | |
243 { | |
244 } | |
245 | |
246 void photon_hidewindow(_THIS, SDL_Window* window) | |
247 { | |
248 } | |
249 | |
250 void photon_raisewindow(_THIS, SDL_Window* window) | |
251 { | |
252 } | |
253 | |
254 void photon_maximizewindow(_THIS, SDL_Window* window) | |
255 { | |
256 } | |
257 | |
258 void photon_minimizewindow(_THIS, SDL_Window* window) | |
259 { | |
260 } | |
261 | |
262 void photon_restorewindow(_THIS, SDL_Window* window) | |
263 { | |
264 } | |
265 | |
266 void photon_setwindowgrab(_THIS, SDL_Window* window) | |
267 { | |
268 } | |
269 | |
270 void photon_destroywindow(_THIS, SDL_Window* window) | |
271 { | |
272 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata; | |
273 SDL_WindowData* wdata=(SDL_WindowData*)window->driverdata; | |
274 | |
275 if (wdata!=NULL) | |
276 { | |
277 } | |
278 } | |
279 | |
280 /*****************************************************************************/ | |
281 /* SDL Window Manager function */ | |
282 /*****************************************************************************/ | |
283 SDL_bool photon_getwindowwminfo(_THIS, SDL_Window* window, struct SDL_SysWMinfo* info) | |
284 { | |
285 if (info->version.major<=SDL_MAJOR_VERSION) | |
286 { | |
287 return SDL_TRUE; | |
288 } | |
289 else | |
290 { | |
291 SDL_SetError("application not compiled with SDL %d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); | |
292 return SDL_FALSE; | |
293 } | |
294 | |
295 /* Failed to get window manager information */ | |
296 return SDL_FALSE; | |
297 } | |
298 | |
299 /*****************************************************************************/ | |
300 /* SDL OpenGL/OpenGL ES functions */ | |
301 /*****************************************************************************/ | |
302 int photon_gl_loadlibrary(_THIS, const char* path) | |
303 { | |
304 /* Failed to load new GL library */ | |
305 return -1; | |
306 } | |
307 | |
308 void* photon_gl_getprocaddres(_THIS, const char* proc) | |
309 { | |
310 /* Failed to get GL function address pointer */ | |
311 return NULL; | |
312 } | |
313 | |
314 void photon_gl_unloadlibrary(_THIS) | |
315 { | |
316 } | |
317 | |
318 SDL_GLContext photon_gl_createcontext(_THIS, SDL_Window* window) | |
319 { | |
320 /* Failed to create GL context */ | |
321 return NULL; | |
322 } | |
323 | |
324 int photon_gl_makecurrent(_THIS, SDL_Window* window, SDL_GLContext context) | |
325 { | |
326 /* Failed to set current GL context */ | |
327 return -1; | |
328 } | |
329 | |
330 int photon_gl_setswapinterval(_THIS, int interval) | |
331 { | |
332 /* Failed to set swap interval */ | |
333 return -1; | |
334 } | |
335 | |
336 int photon_gl_getswapinterval(_THIS) | |
337 { | |
338 /* Failed to get default swap interval */ | |
339 return -1; | |
340 } | |
341 | |
342 void photon_gl_swapwindow(_THIS, SDL_Window* window) | |
343 { | |
344 } | |
345 | |
346 void photon_gl_deletecontext(_THIS, SDL_GLContext context) | |
347 { | |
348 } | |
349 | |
350 /*****************************************************************************/ | |
351 /* SDL Event handling function */ | |
352 /*****************************************************************************/ | |
353 void photon_pumpevents(_THIS) | |
354 { | |
355 } | |
356 | |
357 /*****************************************************************************/ | |
358 /* SDL screen saver related functions */ | |
359 /*****************************************************************************/ | |
360 void photon_suspendscreensaver(_THIS) | |
361 { | |
362 /* There is no screensaver in pure console, it may exist when running */ | |
363 /* GF under Photon, but I do not know, how to disable screensaver */ | |
364 } | |
365 | |
69 /* vi: set ts=4 sw=4 expandtab: */ | 366 /* vi: set ts=4 sw=4 expandtab: */ |