comparison src/video/win32/SDL_win32video.c @ 1712:931d111e737a SDL-1.3

Started framework for Windows video driver
author Sam Lantinga <slouken@libsdl.org>
date Mon, 26 Jun 2006 13:56:56 +0000
parents
children ed4d4f1ea201
comparison
equal deleted inserted replaced
1711:865ba39fc96d 1712:931d111e737a
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2006 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21 */
22 #include "SDL_config.h"
23
24 #include "SDL_video.h"
25 #include "SDL_mouse.h"
26 #include "../SDL_sysvideo.h"
27 #include "../SDL_pixels_c.h"
28
29 #include "SDL_win32video.h"
30 #include "SDL_win32events.h"
31 #include "SDL_win32window.h"
32
33 /* Initialization/Query functions */
34 static int WIN32_VideoInit(_THIS);
35 static int WIN32_SetDisplayMode(_THIS, const SDL_DisplayMode * mode);
36 static void WIN32_VideoQuit(_THIS);
37
38 /* WIN32 driver bootstrap functions */
39
40 static int
41 WIN32_Available(void)
42 {
43 return (1);
44 }
45
46 static void
47 WIN32_DeleteDevice(SDL_VideoDevice * device)
48 {
49 SDL_free(device->hidden);
50 SDL_free(device);
51 }
52
53 static SDL_VideoDevice *
54 WIN32_CreateDevice(int devindex)
55 {
56 SDL_VideoDevice *device;
57
58 /* Initialize all variables that we clean on shutdown */
59 device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
60 if (device) {
61 SDL_memset(device, 0, (sizeof *device));
62 device->hidden = (struct SDL_PrivateVideoData *)
63 SDL_malloc((sizeof *device->hidden));
64 }
65 if ((device == NULL) || (device->hidden == NULL)) {
66 SDL_OutOfMemory();
67 if (device) {
68 SDL_free(device);
69 }
70 return (0);
71 }
72 SDL_memset(device->hidden, 0, (sizeof *device->hidden));
73
74 /* Set the function pointers */
75 device->VideoInit = WIN32_VideoInit;
76 device->SetDisplayMode = WIN32_SetDisplayMode;
77 device->VideoQuit = WIN32_VideoQuit;
78 device->PumpEvents = WIN32_PumpEvents;
79
80 #undef CreateWindow
81 device->CreateWindow = WIN32_CreateWindow;
82 device->CreateWindowFrom = WIN32_CreateWindowFrom;
83 device->SetWindowTitle = WIN32_SetWindowTitle;
84 device->SetWindowPosition = WIN32_SetWindowPosition;
85 device->SetWindowSize = WIN32_SetWindowSize;
86 device->ShowWindow = WIN32_ShowWindow;
87 device->HideWindow = WIN32_HideWindow;
88 device->RaiseWindow = WIN32_RaiseWindow;
89 device->MaximizeWindow = WIN32_MaximizeWindow;
90 device->MinimizeWindow = WIN32_MinimizeWindow;
91 device->RestoreWindow = WIN32_RestoreWindow;
92 device->SetWindowGrab = WIN32_SetWindowGrab;
93 device->DestroyWindow = WIN32_DestroyWindow;
94 device->GetWindowWMInfo = WIN32_GetWindowWMInfo;
95
96 device->free = WIN32_DeleteDevice;
97
98 return device;
99 }
100
101 VideoBootStrap WIN32_bootstrap = {
102 "win32", "SDL Win32/64 video driver",
103 WIN32_Available, WIN32_CreateDevice
104 };
105
106
107 int
108 WIN32_VideoInit(_THIS)
109 {
110 SDL_DisplayMode mode;
111
112 SDL_AddBasicVideoDisplay(NULL);
113 //SDL_AddRenderDriver(0, &SDL_WIN32_RenderDriver);
114
115 SDL_zero(mode);
116 SDL_AddDisplayMode(0, &mode);
117
118 /* We're done! */
119 return 0;
120 }
121
122 static int
123 WIN32_SetDisplayMode(_THIS, const SDL_DisplayMode * mode)
124 {
125 SDL_CurrentDisplay.current_mode = *mode;
126 return 0;
127 }
128
129 void
130 WIN32_VideoQuit(_THIS)
131 {
132 }
133
134 /* vim: set ts=4 sw=4 expandtab: */