comparison src/video/win32/SDL_win32video.c @ 1718:ed4d4f1ea201 SDL-1.3

Further progress on the new Windows video driver: * SDL_SetModuleHandle() is obsolete, I hope. * SDL 1.3 uses the UNICODE API * I'm ignoring Windows CE for the moment, we'll reevaluate what needs to be different for Windows CE later. * Pulled the stdio redirection from WinMain()
author Sam Lantinga <slouken@libsdl.org>
date Tue, 27 Jun 2006 07:46:36 +0000
parents 931d111e737a
children a1ebb17f9c52
comparison
equal deleted inserted replaced
1717:e3637569ab86 1718:ed4d4f1ea201
29 #include "SDL_win32video.h" 29 #include "SDL_win32video.h"
30 #include "SDL_win32events.h" 30 #include "SDL_win32events.h"
31 #include "SDL_win32window.h" 31 #include "SDL_win32window.h"
32 32
33 /* Initialization/Query functions */ 33 /* Initialization/Query functions */
34 static int WIN32_VideoInit(_THIS); 34 static int WIN_VideoInit(_THIS);
35 static int WIN32_SetDisplayMode(_THIS, const SDL_DisplayMode * mode); 35 static int WIN_SetDisplayMode(_THIS, const SDL_DisplayMode * mode);
36 static void WIN32_VideoQuit(_THIS); 36 static void WIN_VideoQuit(_THIS);
37 37
38 /* WIN32 driver bootstrap functions */ 38 /* WIN32 driver bootstrap functions */
39 39
40 static int 40 static int
41 WIN32_Available(void) 41 WIN_Available(void)
42 { 42 {
43 return (1); 43 return (1);
44 } 44 }
45 45
46 static void 46 static void
47 WIN32_DeleteDevice(SDL_VideoDevice * device) 47 WIN_DeleteDevice(SDL_VideoDevice * device)
48 { 48 {
49 SDL_UnregisterApp();
49 SDL_free(device->hidden); 50 SDL_free(device->hidden);
50 SDL_free(device); 51 SDL_free(device);
51 } 52 }
52 53
53 static SDL_VideoDevice * 54 static SDL_VideoDevice *
54 WIN32_CreateDevice(int devindex) 55 WIN_CreateDevice(int devindex)
55 { 56 {
56 SDL_VideoDevice *device; 57 SDL_VideoDevice *device;
58
59 SDL_RegisterApp(NULL, 0, NULL);
57 60
58 /* Initialize all variables that we clean on shutdown */ 61 /* Initialize all variables that we clean on shutdown */
59 device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice)); 62 device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
60 if (device) { 63 if (device) {
61 SDL_memset(device, 0, (sizeof *device)); 64 SDL_memset(device, 0, (sizeof *device));
65 if ((device == NULL) || (device->hidden == NULL)) { 68 if ((device == NULL) || (device->hidden == NULL)) {
66 SDL_OutOfMemory(); 69 SDL_OutOfMemory();
67 if (device) { 70 if (device) {
68 SDL_free(device); 71 SDL_free(device);
69 } 72 }
70 return (0); 73 return NULL;
71 } 74 }
72 SDL_memset(device->hidden, 0, (sizeof *device->hidden)); 75 SDL_memset(device->hidden, 0, (sizeof *device->hidden));
73 76
74 /* Set the function pointers */ 77 /* Set the function pointers */
75 device->VideoInit = WIN32_VideoInit; 78 device->VideoInit = WIN_VideoInit;
76 device->SetDisplayMode = WIN32_SetDisplayMode; 79 device->SetDisplayMode = WIN_SetDisplayMode;
77 device->VideoQuit = WIN32_VideoQuit; 80 device->VideoQuit = WIN_VideoQuit;
78 device->PumpEvents = WIN32_PumpEvents; 81 device->PumpEvents = WIN_PumpEvents;
79 82
80 #undef CreateWindow 83 #undef CreateWindow
81 device->CreateWindow = WIN32_CreateWindow; 84 device->CreateWindow = WIN_CreateWindow;
82 device->CreateWindowFrom = WIN32_CreateWindowFrom; 85 device->CreateWindowFrom = WIN_CreateWindowFrom;
83 device->SetWindowTitle = WIN32_SetWindowTitle; 86 device->SetWindowTitle = WIN_SetWindowTitle;
84 device->SetWindowPosition = WIN32_SetWindowPosition; 87 device->SetWindowPosition = WIN_SetWindowPosition;
85 device->SetWindowSize = WIN32_SetWindowSize; 88 device->SetWindowSize = WIN_SetWindowSize;
86 device->ShowWindow = WIN32_ShowWindow; 89 device->ShowWindow = WIN_ShowWindow;
87 device->HideWindow = WIN32_HideWindow; 90 device->HideWindow = WIN_HideWindow;
88 device->RaiseWindow = WIN32_RaiseWindow; 91 device->RaiseWindow = WIN_RaiseWindow;
89 device->MaximizeWindow = WIN32_MaximizeWindow; 92 device->MaximizeWindow = WIN_MaximizeWindow;
90 device->MinimizeWindow = WIN32_MinimizeWindow; 93 device->MinimizeWindow = WIN_MinimizeWindow;
91 device->RestoreWindow = WIN32_RestoreWindow; 94 device->RestoreWindow = WIN_RestoreWindow;
92 device->SetWindowGrab = WIN32_SetWindowGrab; 95 device->SetWindowGrab = WIN_SetWindowGrab;
93 device->DestroyWindow = WIN32_DestroyWindow; 96 device->DestroyWindow = WIN_DestroyWindow;
94 device->GetWindowWMInfo = WIN32_GetWindowWMInfo; 97 device->GetWindowWMInfo = WIN_GetWindowWMInfo;
95 98
96 device->free = WIN32_DeleteDevice; 99 device->free = WIN_DeleteDevice;
97 100
98 return device; 101 return device;
99 } 102 }
100 103
101 VideoBootStrap WIN32_bootstrap = { 104 VideoBootStrap WIN32_bootstrap = {
102 "win32", "SDL Win32/64 video driver", 105 "win32", "SDL Win32/64 video driver",
103 WIN32_Available, WIN32_CreateDevice 106 WIN_Available, WIN_CreateDevice
104 }; 107 };
105 108
106 109
107 int 110 int
108 WIN32_VideoInit(_THIS) 111 WIN_VideoInit(_THIS)
109 { 112 {
110 SDL_DisplayMode mode; 113 SDL_DisplayMode mode;
111 114
112 SDL_AddBasicVideoDisplay(NULL); 115 SDL_AddBasicVideoDisplay(NULL);
113 //SDL_AddRenderDriver(0, &SDL_WIN32_RenderDriver); 116 //SDL_AddRenderDriver(0, &SDL_WIN_RenderDriver);
114 117
115 SDL_zero(mode); 118 SDL_zero(mode);
116 SDL_AddDisplayMode(0, &mode); 119 SDL_AddDisplayMode(0, &mode);
117 120
118 /* We're done! */ 121 /* We're done! */
119 return 0; 122 return 0;
120 } 123 }
121 124
122 static int 125 static int
123 WIN32_SetDisplayMode(_THIS, const SDL_DisplayMode * mode) 126 WIN_SetDisplayMode(_THIS, const SDL_DisplayMode * mode)
124 { 127 {
125 SDL_CurrentDisplay.current_mode = *mode; 128 SDL_CurrentDisplay.current_mode = *mode;
126 return 0; 129 return 0;
127 } 130 }
128 131
129 void 132 void
130 WIN32_VideoQuit(_THIS) 133 WIN_VideoQuit(_THIS)
131 { 134 {
132 } 135 }
133 136
134 /* vim: set ts=4 sw=4 expandtab: */ 137 /* vim: set ts=4 sw=4 expandtab: */