Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_win32video.c @ 1720:a1ebb17f9c52 SDL-1.3
Cleaned up a bunch of warnings, started adding Win32 event support
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 30 Jun 2006 05:42:49 +0000 |
parents | ed4d4f1ea201 |
children | 6c63fc2bd986 |
comparison
equal
deleted
inserted
replaced
1719:5b9f50c957ed | 1720:a1ebb17f9c52 |
---|---|
19 Sam Lantinga | 19 Sam Lantinga |
20 slouken@libsdl.org | 20 slouken@libsdl.org |
21 */ | 21 */ |
22 #include "SDL_config.h" | 22 #include "SDL_config.h" |
23 | 23 |
24 #include "SDL_main.h" | |
24 #include "SDL_video.h" | 25 #include "SDL_video.h" |
25 #include "SDL_mouse.h" | 26 #include "SDL_mouse.h" |
26 #include "../SDL_sysvideo.h" | 27 #include "../SDL_sysvideo.h" |
27 #include "../SDL_pixels_c.h" | 28 #include "../SDL_pixels_c.h" |
28 | 29 |
45 | 46 |
46 static void | 47 static void |
47 WIN_DeleteDevice(SDL_VideoDevice * device) | 48 WIN_DeleteDevice(SDL_VideoDevice * device) |
48 { | 49 { |
49 SDL_UnregisterApp(); | 50 SDL_UnregisterApp(); |
50 SDL_free(device->hidden); | 51 SDL_free(device->driverdata); |
51 SDL_free(device); | 52 SDL_free(device); |
52 } | 53 } |
53 | 54 |
54 static SDL_VideoDevice * | 55 static SDL_VideoDevice * |
55 WIN_CreateDevice(int devindex) | 56 WIN_CreateDevice(int devindex) |
57 SDL_VideoDevice *device; | 58 SDL_VideoDevice *device; |
58 | 59 |
59 SDL_RegisterApp(NULL, 0, NULL); | 60 SDL_RegisterApp(NULL, 0, NULL); |
60 | 61 |
61 /* Initialize all variables that we clean on shutdown */ | 62 /* Initialize all variables that we clean on shutdown */ |
62 device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice)); | 63 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); |
63 if (device) { | 64 if (device) { |
64 SDL_memset(device, 0, (sizeof *device)); | 65 device->driverdata = |
65 device->hidden = (struct SDL_PrivateVideoData *) | 66 (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); |
66 SDL_malloc((sizeof *device->hidden)); | |
67 } | 67 } |
68 if ((device == NULL) || (device->hidden == NULL)) { | 68 if (!device || !device->driverdata) { |
69 SDL_OutOfMemory(); | 69 SDL_OutOfMemory(); |
70 if (device) { | 70 if (device) { |
71 SDL_free(device); | 71 SDL_free(device); |
72 } | 72 } |
73 return NULL; | 73 return NULL; |
74 } | 74 } |
75 SDL_memset(device->hidden, 0, (sizeof *device->hidden)); | |
76 | 75 |
77 /* Set the function pointers */ | 76 /* Set the function pointers */ |
78 device->VideoInit = WIN_VideoInit; | 77 device->VideoInit = WIN_VideoInit; |
79 device->SetDisplayMode = WIN_SetDisplayMode; | 78 device->SetDisplayMode = WIN_SetDisplayMode; |
80 device->VideoQuit = WIN_VideoQuit; | 79 device->VideoQuit = WIN_VideoQuit; |
116 //SDL_AddRenderDriver(0, &SDL_WIN_RenderDriver); | 115 //SDL_AddRenderDriver(0, &SDL_WIN_RenderDriver); |
117 | 116 |
118 SDL_zero(mode); | 117 SDL_zero(mode); |
119 SDL_AddDisplayMode(0, &mode); | 118 SDL_AddDisplayMode(0, &mode); |
120 | 119 |
120 WIN_AddKeyboard(_this); | |
121 WIN_AddMouse(_this); | |
122 | |
121 /* We're done! */ | 123 /* We're done! */ |
122 return 0; | 124 return 0; |
123 } | 125 } |
124 | 126 |
125 static int | 127 static int |