Mercurial > sdl-ios-xcode
comparison src/video/dc/SDL_dcvideo.c @ 1361:19418e4422cb
New configure-based build system. Still work in progress, but much improved
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 16 Feb 2006 10:11:48 +0000 |
parents | c71e05b4dc2e |
children | d910939febfa |
comparison
equal
deleted
inserted
replaced
1360:70a9cfb4cf1b | 1361:19418e4422cb |
---|---|
20 slouken@libsdl.org | 20 slouken@libsdl.org |
21 */ | 21 */ |
22 | 22 |
23 #include "SDL_video.h" | 23 #include "SDL_video.h" |
24 #include "SDL_mouse.h" | 24 #include "SDL_mouse.h" |
25 #include "SDL_sysvideo.h" | 25 #include "../SDL_sysvideo.h" |
26 #include "SDL_pixels_c.h" | 26 #include "../SDL_pixels_c.h" |
27 #include "SDL_events_c.h" | 27 #include "../../events/SDL_events_c.h" |
28 | 28 |
29 #include "SDL_dcvideo.h" | 29 #include "SDL_dcvideo.h" |
30 #include "SDL_dcevents_c.h" | 30 #include "SDL_dcevents_c.h" |
31 #include "SDL_dcmouse_c.h" | 31 #include "SDL_dcmouse_c.h" |
32 | 32 |
33 #include <dc/video.h> | 33 #include <dc/video.h> |
34 #include <dc/pvr.h> | 34 #include <dc/pvr.h> |
35 | |
36 #ifdef HAVE_OPENGL | |
37 #include <GL/gl.h> | |
38 #endif | |
39 | 35 |
40 | 36 |
41 /* Initialization/Query functions */ | 37 /* Initialization/Query functions */ |
42 static int DC_VideoInit(_THIS, SDL_PixelFormat *vformat); | 38 static int DC_VideoInit(_THIS, SDL_PixelFormat *vformat); |
43 static SDL_Rect **DC_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); | 39 static SDL_Rect **DC_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); |
109 device->SetHWAlpha = NULL; | 105 device->SetHWAlpha = NULL; |
110 device->LockHWSurface = DC_LockHWSurface; | 106 device->LockHWSurface = DC_LockHWSurface; |
111 device->UnlockHWSurface = DC_UnlockHWSurface; | 107 device->UnlockHWSurface = DC_UnlockHWSurface; |
112 device->FlipHWSurface = DC_FlipHWSurface; | 108 device->FlipHWSurface = DC_FlipHWSurface; |
113 device->FreeHWSurface = DC_FreeHWSurface; | 109 device->FreeHWSurface = DC_FreeHWSurface; |
114 #ifdef HAVE_OPENGL | 110 #if SDL_VIDEO_OPENGL |
115 device->GL_LoadLibrary = DC_GL_LoadLibrary; | 111 device->GL_LoadLibrary = DC_GL_LoadLibrary; |
116 device->GL_GetProcAddress = DC_GL_GetProcAddress; | 112 device->GL_GetProcAddress = DC_GL_GetProcAddress; |
117 device->GL_GetAttribute = DC_GL_GetAttribute; | 113 device->GL_GetAttribute = DC_GL_GetAttribute; |
118 device->GL_MakeCurrent = NULL; | 114 device->GL_MakeCurrent = NULL; |
119 device->GL_SwapBuffers = DC_GL_SwapBuffers; | 115 device->GL_SwapBuffers = DC_GL_SwapBuffers; |
182 | 178 |
183 /* Vertex buffer size */ | 179 /* Vertex buffer size */ |
184 512*1024 | 180 512*1024 |
185 }; | 181 }; |
186 | 182 |
187 #ifdef HAVE_OPENGL | 183 #if SDL_VIDEO_OPENGL |
188 static int pvr_inited; | 184 static int pvr_inited; |
189 #endif | 185 #endif |
190 | 186 |
191 SDL_Surface *DC_SetVideoMode(_THIS, SDL_Surface *current, | 187 SDL_Surface *DC_SetVideoMode(_THIS, SDL_Surface *current, |
192 int width, int height, int bpp, Uint32 flags) | 188 int width, int height, int bpp, Uint32 flags) |
218 case 24: bpp = 32; | 214 case 24: bpp = 32; |
219 case 32: pixel_mode = PM_RGB888; pitch = width*4; | 215 case 32: pixel_mode = PM_RGB888; pitch = width*4; |
220 Rmask = 0x00ff0000; | 216 Rmask = 0x00ff0000; |
221 Gmask = 0x0000ff00; | 217 Gmask = 0x0000ff00; |
222 Bmask = 0x000000ff; | 218 Bmask = 0x000000ff; |
223 #ifdef HAVE_OPENGL | 219 #if SDL_VIDEO_OPENGL |
224 if (!(flags & SDL_OPENGL)) | 220 if (!(flags & SDL_OPENGL)) |
225 #endif | 221 #endif |
226 break; | 222 break; |
227 default: | 223 default: |
228 SDL_SetError("Couldn't find requested mode in list"); | 224 SDL_SetError("Couldn't find requested mode in list"); |
239 current->flags = (SDL_FULLSCREEN|SDL_HWSURFACE); | 235 current->flags = (SDL_FULLSCREEN|SDL_HWSURFACE); |
240 current->w = width; | 236 current->w = width; |
241 current->h = height; | 237 current->h = height; |
242 current->pitch = pitch; | 238 current->pitch = pitch; |
243 | 239 |
244 #ifdef HAVE_OPENGL | 240 #if SDL_VIDEO_OPENGL |
245 if (pvr_inited) { | 241 if (pvr_inited) { |
246 pvr_inited = 0; | 242 pvr_inited = 0; |
247 pvr_shutdown(); | 243 pvr_shutdown(); |
248 } | 244 } |
249 #endif | 245 #endif |
250 | 246 |
251 vid_set_mode(disp_mode,pixel_mode); | 247 vid_set_mode(disp_mode,pixel_mode); |
252 | 248 |
253 current->pixels = vram_s; | 249 current->pixels = vram_s; |
254 | 250 |
255 #ifdef HAVE_OPENGL | 251 #if SDL_VIDEO_OPENGL |
256 if (flags & SDL_OPENGL) { | 252 if (flags & SDL_OPENGL) { |
257 this->gl_config.driver_loaded = 1; | 253 this->gl_config.driver_loaded = 1; |
258 current->flags = SDL_FULLSCREEN | SDL_OPENGL; | 254 current->flags = SDL_FULLSCREEN | SDL_OPENGL; |
259 current->pixels = NULL; | 255 current->pixels = NULL; |
260 pvr_inited = 1; | 256 pvr_inited = 1; |
316 /* Note: If we are terminated, this could be called in the middle of | 312 /* Note: If we are terminated, this could be called in the middle of |
317 another SDL video routine -- notably UpdateRects. | 313 another SDL video routine -- notably UpdateRects. |
318 */ | 314 */ |
319 static void DC_VideoQuit(_THIS) | 315 static void DC_VideoQuit(_THIS) |
320 { | 316 { |
321 #ifdef HAVE_OPENGL | 317 #if SDL_VIDEO_OPENGL |
322 if (pvr_inited) { | 318 if (pvr_inited) { |
323 pvr_inited = 0; | 319 pvr_inited = 0; |
324 pvr_shutdown(); | 320 pvr_shutdown(); |
325 } | 321 } |
326 #endif | 322 #endif |
327 } | 323 } |
328 | 324 |
329 #ifdef HAVE_OPENGL | 325 #if SDL_VIDEO_OPENGL |
330 | 326 |
331 void dmyfunc(void) {} | 327 void dmyfunc(void) {} |
332 | 328 |
333 typedef void (*funcptr)(); | 329 typedef void (*funcptr)(); |
334 const static struct { | 330 const static struct { |