Mercurial > sdl-ios-xcode
annotate src/video/dummy/SDL_nullvideo.c @ 297:f6ffac90895c
Updated copyright information for 2002
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 06 Mar 2002 11:23:08 +0000 |
parents | e8157fcb3114 |
children | b8d311d90021 |
rev | line source |
---|---|
1
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
1 /* |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
297
f6ffac90895c
Updated copyright information for 2002
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga |
1
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
4 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Library General Public |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
8 version 2 of the License, or (at your option) any later version. |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
9 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
13 Library General Public License for more details. |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
14 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Library General Public |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
18 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
19 Sam Lantinga |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
235
diff
changeset
|
20 slouken@libsdl.org |
1
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
21 */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
22 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
23 #ifdef SAVE_RCSID |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
24 static char rcsid = |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
25 "@(#) $Id$"; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
26 #endif |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
27 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
28 /* Dummy SDL video driver implementation; this is just enough to make an |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
29 * SDL-based application THINK it's got a working video driver, for |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
30 * applications that call SDL_Init(SDL_INIT_VIDEO) when they don't need it, |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
31 * and also for use as a collection of stubs when porting SDL to a new |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
32 * platform for which you haven't yet written a valid video driver. |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
33 * |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
34 * This is also a great way to determine bottlenecks: if you think that SDL |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
35 * is a performance problem for a given platform, enable this driver, and |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
36 * then see if your application runs faster without video overhead. |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
37 * |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
38 * Initial work by Ryan C. Gordon (icculus@linuxgames.com). A good portion |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
39 * of this was cut-and-pasted from Stephane Peter's work in the AAlib |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
40 * SDL video driver. Renamed to "DUMMY" by Sam Lantinga. |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
41 */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
42 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
43 #include <stdio.h> |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
44 #include <stdlib.h> |
151 | 45 #include <string.h> |
1
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
46 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
47 #include "SDL.h" |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
48 #include "SDL_error.h" |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
49 #include "SDL_video.h" |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
50 #include "SDL_mouse.h" |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
51 #include "SDL_sysvideo.h" |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
52 #include "SDL_pixels_c.h" |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
53 #include "SDL_events_c.h" |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
54 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
55 #include "SDL_nullvideo.h" |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
56 #include "SDL_nullevents_c.h" |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
57 #include "SDL_nullmouse_c.h" |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
58 |
86
13e4c612098d
Dummy audio and video drivers are enabled (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
1
diff
changeset
|
59 #define DUMMYVID_DRIVER_NAME "dummy" |
13e4c612098d
Dummy audio and video drivers are enabled (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
1
diff
changeset
|
60 |
1
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
61 /* Initialization/Query functions */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
62 static int DUMMY_VideoInit(_THIS, SDL_PixelFormat *vformat); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
63 static SDL_Rect **DUMMY_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
64 static SDL_Surface *DUMMY_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
65 static int DUMMY_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
66 static void DUMMY_VideoQuit(_THIS); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
67 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
68 /* Hardware surface functions */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
69 static int DUMMY_AllocHWSurface(_THIS, SDL_Surface *surface); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
70 static int DUMMY_LockHWSurface(_THIS, SDL_Surface *surface); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
71 static void DUMMY_UnlockHWSurface(_THIS, SDL_Surface *surface); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
72 static void DUMMY_FreeHWSurface(_THIS, SDL_Surface *surface); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
73 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
74 /* etc. */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
75 static void DUMMY_UpdateRects(_THIS, int numrects, SDL_Rect *rects); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
76 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
77 /* DUMMY driver bootstrap functions */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
78 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
79 static int DUMMY_Available(void) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
80 { |
86
13e4c612098d
Dummy audio and video drivers are enabled (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
1
diff
changeset
|
81 const char *envr = getenv("SDL_VIDEODRIVER"); |
13e4c612098d
Dummy audio and video drivers are enabled (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
1
diff
changeset
|
82 if ((envr) && (strcmp(envr, DUMMYVID_DRIVER_NAME) == 0)) { |
13e4c612098d
Dummy audio and video drivers are enabled (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
1
diff
changeset
|
83 return(1); |
13e4c612098d
Dummy audio and video drivers are enabled (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
1
diff
changeset
|
84 } |
13e4c612098d
Dummy audio and video drivers are enabled (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
1
diff
changeset
|
85 |
13e4c612098d
Dummy audio and video drivers are enabled (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
1
diff
changeset
|
86 return(0); |
1
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
87 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
88 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
89 static void DUMMY_DeleteDevice(SDL_VideoDevice *device) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
90 { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
91 free(device->hidden); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
92 free(device); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
93 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
94 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
95 static SDL_VideoDevice *DUMMY_CreateDevice(int devindex) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
96 { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
97 SDL_VideoDevice *device; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
98 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
99 /* Initialize all variables that we clean on shutdown */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
100 device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
101 if ( device ) { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
102 memset(device, 0, (sizeof *device)); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
103 device->hidden = (struct SDL_PrivateVideoData *) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
104 malloc((sizeof *device->hidden)); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
105 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
106 if ( (device == NULL) || (device->hidden == NULL) ) { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
107 SDL_OutOfMemory(); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
108 if ( device ) { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
109 free(device); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
110 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
111 return(0); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
112 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
113 memset(device->hidden, 0, (sizeof *device->hidden)); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
114 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
115 /* Set the function pointers */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
116 device->VideoInit = DUMMY_VideoInit; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
117 device->ListModes = DUMMY_ListModes; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
118 device->SetVideoMode = DUMMY_SetVideoMode; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
119 device->CreateYUVOverlay = NULL; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
120 device->SetColors = DUMMY_SetColors; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
121 device->UpdateRects = DUMMY_UpdateRects; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
122 device->VideoQuit = DUMMY_VideoQuit; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
123 device->AllocHWSurface = DUMMY_AllocHWSurface; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
124 device->CheckHWBlit = NULL; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
125 device->FillHWRect = NULL; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
126 device->SetHWColorKey = NULL; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
127 device->SetHWAlpha = NULL; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
128 device->LockHWSurface = DUMMY_LockHWSurface; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
129 device->UnlockHWSurface = DUMMY_UnlockHWSurface; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
130 device->FlipHWSurface = NULL; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
131 device->FreeHWSurface = DUMMY_FreeHWSurface; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
132 device->SetCaption = NULL; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
133 device->SetIcon = NULL; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
134 device->IconifyWindow = NULL; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
135 device->GrabInput = NULL; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
136 device->GetWMInfo = NULL; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
137 device->InitOSKeymap = DUMMY_InitOSKeymap; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
138 device->PumpEvents = DUMMY_PumpEvents; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
139 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
140 device->free = DUMMY_DeleteDevice; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
141 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
142 return device; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
143 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
144 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
145 VideoBootStrap DUMMY_bootstrap = { |
86
13e4c612098d
Dummy audio and video drivers are enabled (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
1
diff
changeset
|
146 DUMMYVID_DRIVER_NAME, "SDL dummy video driver", |
1
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
147 DUMMY_Available, DUMMY_CreateDevice |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
148 }; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
149 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
150 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
151 int DUMMY_VideoInit(_THIS, SDL_PixelFormat *vformat) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
152 { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
153 fprintf(stderr, "WARNING: You are using the SDL dummy video driver!\n"); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
154 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
155 /* Determine the screen depth (use default 8-bit depth) */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
156 /* we change this during the SDL_SetVideoMode implementation... */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
157 vformat->BitsPerPixel = 8; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
158 vformat->BytesPerPixel = 1; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
159 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
160 /* We're done! */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
161 return(0); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
162 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
163 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
164 SDL_Rect **DUMMY_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
165 { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
166 return (SDL_Rect **) -1; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
167 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
168 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
169 SDL_Surface *DUMMY_SetVideoMode(_THIS, SDL_Surface *current, |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
170 int width, int height, int bpp, Uint32 flags) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
171 { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
172 if ( this->hidden->buffer ) { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
173 free( this->hidden->buffer ); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
174 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
175 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
176 this->hidden->buffer = malloc(width * height * (bpp / 8)); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
177 if ( ! this->hidden->buffer ) { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
178 SDL_SetError("Couldn't allocate buffer for requested mode"); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
179 return(NULL); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
180 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
181 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
182 /* printf("Setting mode %dx%d\n", width, height); */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
183 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
184 memset(this->hidden->buffer, 0, width * height * (bpp / 8)); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
185 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
186 /* Allocate the new pixel format for the screen */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
187 if ( ! SDL_ReallocFormat(current, bpp, 0, 0, 0, 0) ) { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
188 free(this->hidden->buffer); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
189 this->hidden->buffer = NULL; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
190 SDL_SetError("Couldn't allocate new pixel format for requested mode"); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
191 return(NULL); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
192 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
193 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
194 /* Set up the new mode framebuffer */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
195 current->flags = flags & SDL_FULLSCREEN; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
196 this->hidden->w = current->w = width; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
197 this->hidden->h = current->h = height; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
198 current->pitch = current->w * (bpp / 8); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
199 current->pixels = this->hidden->buffer; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
200 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
201 /* We're done */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
202 return(current); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
203 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
204 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
205 /* We don't actually allow hardware surfaces other than the main one */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
206 static int DUMMY_AllocHWSurface(_THIS, SDL_Surface *surface) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
207 { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
208 return(-1); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
209 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
210 static void DUMMY_FreeHWSurface(_THIS, SDL_Surface *surface) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
211 { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
212 return; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
213 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
214 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
215 /* We need to wait for vertical retrace on page flipped displays */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
216 static int DUMMY_LockHWSurface(_THIS, SDL_Surface *surface) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
217 { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
218 return(0); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
219 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
220 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
221 static void DUMMY_UnlockHWSurface(_THIS, SDL_Surface *surface) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
222 { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
223 return; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
224 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
225 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
226 static void DUMMY_UpdateRects(_THIS, int numrects, SDL_Rect *rects) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
227 { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
228 /* do nothing. */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
229 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
230 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
231 int DUMMY_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
232 { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
233 /* do nothing of note. */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
234 return(1); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
235 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
236 |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
237 /* Note: If we are terminated, this could be called in the middle of |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
238 another SDL video routine -- notably UpdateRects. |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
239 */ |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
240 void DUMMY_VideoQuit(_THIS) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
241 { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
242 if (this->screen->pixels != NULL) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
243 { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
244 free(this->screen->pixels); |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
245 this->screen->pixels = NULL; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
246 } |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
247 } |