annotate src/video/win32/SDL_win32video.c @ 4755:436183eb30c8

Merge with main repo (mainly for non-printable character fix)
author dewyatt
date Sun, 18 Jul 2010 13:48:23 -0400
parents 22aa6a631d34 9faebccfefb3
children bb2e32f5a556
rev   line source
4755
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
1 /*
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
2 SDL - Simple DirectMedia Layer
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
3 Copyright (C) 1997-2010 Sam Lantinga
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
4
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
5 This library is free software; you can redistribute it and/or
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
6 modify it under the terms of the GNU Lesser General Public
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
7 License as published by the Free Software Foundation; either
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
9
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
10 This library is distributed in the hope that it will be useful,
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
13 Lesser General Public License for more details.
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
14
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
15 You should have received a copy of the GNU Lesser General Public
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
16 License along with this library; if not, write to the Free Software
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
18
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
19 Sam Lantinga
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
20 slouken@libsdl.org
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
21 */
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
22 #include "SDL_config.h"
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
23
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
24 #include "SDL_main.h"
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
25 #include "SDL_video.h"
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
26 #include "SDL_mouse.h"
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
27 #include "../SDL_sysvideo.h"
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
28 #include "../SDL_pixels_c.h"
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
29
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
30 #include "SDL_win32video.h"
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
31 #include "SDL_d3drender.h"
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
32 #include "SDL_gdirender.h"
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
33
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
34 /* Initialization/Query functions */
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
35 static int WIN_VideoInit(_THIS);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
36 static void WIN_VideoQuit(_THIS);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
37
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
38 /* Sets an error message based on GetLastError() */
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
39 void
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
40 WIN_SetError(const char *prefix)
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
41 {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
42 TCHAR buffer[1024];
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
43 char *message;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
44 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
45 buffer, SDL_arraysize(buffer), NULL);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
46 message = WIN_StringToUTF8(buffer);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
47 SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
48 SDL_free(message);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
49 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
50
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
51 /* WIN32 driver bootstrap functions */
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
52
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
53 static int
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
54 WIN_Available(void)
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
55 {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
56 return (1);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
57 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
58
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
59 static void
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
60 WIN_DeleteDevice(SDL_VideoDevice * device)
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
61 {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
62 SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
63
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
64 SDL_UnregisterApp();
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
65 #if SDL_VIDEO_RENDER_D3D
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
66 if (data->d3d) {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
67 IDirect3D9_Release(data->d3d);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
68 FreeLibrary(data->d3dDLL);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
69 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
70 #endif
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
71 #if SDL_VIDEO_RENDER_DDRAW
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
72 if (data->ddraw) {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
73 data->ddraw->lpVtbl->Release(data->ddraw);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
74 FreeLibrary(data->ddrawDLL);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
75 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
76 #endif
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
77 SDL_free(device->driverdata);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
78 SDL_free(device);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
79 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
80
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
81 static SDL_VideoDevice *
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
82 WIN_CreateDevice(int devindex)
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
83 {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
84 SDL_VideoDevice *device;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
85 SDL_VideoData *data;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
86
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
87 SDL_RegisterApp(NULL, 0, NULL);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
88
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
89 /* Initialize all variables that we clean on shutdown */
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
90 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
91 if (device) {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
92 data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
93 } else {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
94 data = NULL;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
95 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
96 if (!data) {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
97 SDL_OutOfMemory();
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
98 if (device) {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
99 SDL_free(device);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
100 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
101 return NULL;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
102 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
103 device->driverdata = data;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
104
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
105 #if SDL_VIDEO_RENDER_D3D
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
106 data->d3dDLL = LoadLibrary(TEXT("D3D9.DLL"));
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
107 if (data->d3dDLL) {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
108 IDirect3D9 *(WINAPI * D3DCreate) (UINT SDKVersion);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
109
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
110 D3DCreate =
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
111 (IDirect3D9 * (WINAPI *) (UINT)) GetProcAddress(data->d3dDLL,
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
112 "Direct3DCreate9");
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
113 if (D3DCreate) {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
114 data->d3d = D3DCreate(D3D_SDK_VERSION);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
115 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
116 if (!data->d3d) {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
117 FreeLibrary(data->d3dDLL);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
118 data->d3dDLL = NULL;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
119 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
120 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
121 #endif /* SDL_VIDEO_RENDER_D3D */
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
122 #if SDL_VIDEO_RENDER_DDRAW
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
123 data->ddrawDLL = LoadLibrary(TEXT("ddraw.dll"));
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
124 if (data->ddrawDLL) {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
125 IDirectDraw *(WINAPI * DDCreate) (GUID FAR * lpGUID,
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
126 LPDIRECTDRAW FAR * lplpDD,
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
127 IUnknown FAR * pUnkOuter);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
128
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
129 DDCreate =
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
130 (IDirectDraw *
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
131 (WINAPI *) (GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *))
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
132 GetProcAddress(data->ddrawDLL, TEXT("DirectDrawCreate"));
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
133 if (!DDCreate || DDCreate(NULL, &data->ddraw, NULL) != DD_OK) {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
134 FreeLibrary(data->ddrawDLL);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
135 data->ddrawDLL = NULL;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
136 data->ddraw = NULL;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
137 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
138 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
139 #endif /* SDL_VIDEO_RENDER_DDRAW */
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
140
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
141 /* Set the function pointers */
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
142 device->VideoInit = WIN_VideoInit;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
143 device->VideoQuit = WIN_VideoQuit;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
144 device->GetDisplayBounds = WIN_GetDisplayBounds;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
145 device->GetDisplayModes = WIN_GetDisplayModes;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
146 device->SetDisplayMode = WIN_SetDisplayMode;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
147 device->SetDisplayGammaRamp = WIN_SetDisplayGammaRamp;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
148 device->GetDisplayGammaRamp = WIN_GetDisplayGammaRamp;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
149 device->PumpEvents = WIN_PumpEvents;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
150
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
151 #undef CreateWindow
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
152 device->CreateWindow = WIN_CreateWindow;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
153 device->CreateWindowFrom = WIN_CreateWindowFrom;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
154 device->SetWindowTitle = WIN_SetWindowTitle;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
155 device->SetWindowIcon = WIN_SetWindowIcon;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
156 device->SetWindowPosition = WIN_SetWindowPosition;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
157 device->SetWindowSize = WIN_SetWindowSize;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
158 device->ShowWindow = WIN_ShowWindow;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
159 device->HideWindow = WIN_HideWindow;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
160 device->RaiseWindow = WIN_RaiseWindow;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
161 device->MaximizeWindow = WIN_MaximizeWindow;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
162 device->MinimizeWindow = WIN_MinimizeWindow;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
163 device->RestoreWindow = WIN_RestoreWindow;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
164 device->SetWindowGrab = WIN_SetWindowGrab;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
165 device->DestroyWindow = WIN_DestroyWindow;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
166 device->GetWindowWMInfo = WIN_GetWindowWMInfo;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
167 #ifdef SDL_VIDEO_OPENGL_WGL
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
168 device->GL_LoadLibrary = WIN_GL_LoadLibrary;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
169 device->GL_GetProcAddress = WIN_GL_GetProcAddress;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
170 device->GL_UnloadLibrary = WIN_GL_UnloadLibrary;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
171 device->GL_CreateContext = WIN_GL_CreateContext;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
172 device->GL_MakeCurrent = WIN_GL_MakeCurrent;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
173 device->GL_SetSwapInterval = WIN_GL_SetSwapInterval;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
174 device->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
175 device->GL_SwapWindow = WIN_GL_SwapWindow;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
176 device->GL_DeleteContext = WIN_GL_DeleteContext;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
177 #endif
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
178 device->StartTextInput = WIN_StartTextInput;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
179 device->StopTextInput = WIN_StopTextInput;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
180 device->SetTextInputRect = WIN_SetTextInputRect;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
181
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
182 device->SetClipboardText = WIN_SetClipboardText;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
183 device->GetClipboardText = WIN_GetClipboardText;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
184 device->HasClipboardText = WIN_HasClipboardText;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
185
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
186 device->free = WIN_DeleteDevice;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
187
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
188 return device;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
189 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
190
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
191 VideoBootStrap WIN32_bootstrap = {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
192 "win32", "SDL Win32/64 video driver", WIN_Available, WIN_CreateDevice
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
193 };
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
194
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
195
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
196 int
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
197 WIN_VideoInit(_THIS)
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
198 {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
199 if (WIN_InitModes(_this) < 0) {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
200 return -1;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
201 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
202
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
203 #if SDL_VIDEO_RENDER_D3D
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
204 D3D_AddRenderDriver(_this);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
205 #endif
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
206 #if SDL_VIDEO_RENDER_DDRAW
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
207 DDRAW_AddRenderDriver(_this);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
208 #endif
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
209 #if SDL_VIDEO_RENDER_GDI
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
210 GDI_AddRenderDriver(_this);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
211 #endif
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
212 #if SDL_VIDEO_RENDER_GAPI
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
213 GAPI_AddRenderDriver(_this);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
214 #endif
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
215
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
216 WIN_InitKeyboard(_this);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
217 WIN_InitMouse(_this);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
218
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
219 return 0;
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
220 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
221
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
222 void
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
223 WIN_VideoQuit(_THIS)
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
224 {
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
225 WIN_QuitModes(_this);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
226 WIN_QuitKeyboard(_this);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
227 WIN_QuitMouse(_this);
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
228 }
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
229
436183eb30c8 Merge with main repo (mainly for non-printable character fix)
dewyatt
parents: 4750 4504
diff changeset
230 /* vim: set ts=4 sw=4 expandtab: */