2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2009 Sam Lantinga
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.
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.
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
22 #include "SDL_config.h"
24 #ifndef _SDL_lowvideo_h
25 #define _SDL_lowvideo_h
27 #define WIN32_LEAN_AND_MEAN
30 #ifndef SetClassLongPtr
31 #define SetClassLongPtr SetClassLong
33 #ifndef GetWindowLongPtr
34 #define GetWindowLongPtr GetWindowLong
36 #ifndef SetWindowLongPtr
37 #define SetWindowLongPtr SetWindowLong
40 #define GWLP_WNDPROC GWL_WNDPROC
42 #ifndef GWLP_HINSTANCE
43 #define GWLP_HINSTANCE GWL_HINSTANCE
46 #define GCLP_HICON GCL_HICON
49 #include "../SDL_sysvideo.h"
51 /* Hidden "this" pointer for the video functions */
52 #define _THIS SDL_VideoDevice *this
54 #define FULLSCREEN() \
55 ((SDL_VideoSurface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN)
57 #define WINDIB_FULLSCREEN() \
61 (((SDL_VideoSurface->flags & SDL_OPENGL ) == SDL_OPENGL ) || \
62 ((SDL_strcmp(this->name, "windib") == 0) || \
63 (SDL_strcmp(this->name, "gapi") == 0))) \
65 #define DDRAW_FULLSCREEN() \
69 ((SDL_VideoSurface->flags & SDL_OPENGL ) != SDL_OPENGL ) && \
70 (SDL_strcmp(this->name, "directx") == 0) \
73 #define DINPUT_FULLSCREEN() \
76 (strcmp(this->name, "directx") == 0) \
79 #define DINPUT() (strcmp(this->name, "directx") == 0)
81 /* The main window -- and a function to set it for the audio */
83 extern LPWSTR SDL_Appname;
85 extern LPSTR SDL_Appname;
87 extern HINSTANCE SDL_Instance;
88 extern HWND SDL_Window;
89 extern BOOL SDL_windowid;
91 /* Variables and functions exported to other parts of the native video
92 subsystem (SDL_sysevents.c)
94 extern void WIN_FlushMessageQueue();
96 /* Called by windows message loop when application is activated */
97 extern void (*WIN_Activate)(_THIS, BOOL active, BOOL minimized);
99 /* Called by windows message loop when system palette is available */
100 extern void (*WIN_RealizePalette)(_THIS);
102 /* Called by windows message loop when the system palette changes */
103 extern void (*WIN_PaletteChanged)(_THIS, HWND window);
105 /* Called by windows message loop when a portion of the screen needs update */
106 extern void (*WIN_WinPAINT)(_THIS, HDC hdc);
108 /* Called by windows message loop when the message isn't handled */
109 extern LONG (*HandleMessage)(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
111 /* The window cursor (from SDL_sysmouse.c) */
112 extern HCURSOR SDL_hcursor;
114 /* The bounds of the window in screen coordinates */
115 extern RECT SDL_bounds;
117 /* The position of the window in windowed mode */
118 extern int SDL_windowX;
119 extern int SDL_windowY;
121 /* Flag -- SDL is performing a resize, rather than the user */
122 extern int SDL_resizing;
124 /* Flag -- the mouse is in relative motion mode */
125 extern int mouse_relative;
127 /* The GDI fullscreen mode currently active */
128 #ifndef NO_CHANGEDISPLAYSETTINGS
129 extern DEVMODE SDL_desktop_mode;
130 extern DEVMODE SDL_fullscreen_mode;
133 /* The system gamma ramp for GDI modes */
134 extern WORD *gamma_saved;
136 /* This is really from SDL_dx5audio.c */
137 extern void DX5_SoundFocus(HWND window);
139 /* DJM: This is really from SDL_sysevents.c, we need it in
140 GDL_CreateWindow as well */
141 LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
143 /* JFP: Implementation of ToUnicode() that works on 9x/ME/2K/XP */
144 typedef int (WINAPI *ToUnicodeFN)(UINT, UINT, PBYTE, LPWSTR, int, UINT);
146 extern ToUnicodeFN SDL_ToUnicode;
148 #endif /* SDL_lowvideo_h */