2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
26 ===========================================================================
29 #ifndef __WIN_LOCAL_H__
30 #define __WIN_LOCAL_H__
33 #include "../../renderer/wglext.h" // windows OpenGL extensions
35 // WGL_ARB_extensions_string
36 extern PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
38 // WGL_EXT_swap_interval
39 extern PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
41 // WGL_ARB_pixel_format
42 extern PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribivARB;
43 extern PFNWGLGETPIXELFORMATATTRIBFVARBPROC wglGetPixelFormatAttribfvARB;
44 extern PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB;
47 extern PFNWGLCREATEPBUFFERARBPROC wglCreatePbufferARB;
48 extern PFNWGLGETPBUFFERDCARBPROC wglGetPbufferDCARB;
49 extern PFNWGLRELEASEPBUFFERDCARBPROC wglReleasePbufferDCARB;
50 extern PFNWGLDESTROYPBUFFERARBPROC wglDestroyPbufferARB;
51 extern PFNWGLQUERYPBUFFERARBPROC wglQueryPbufferARB;
53 // WGL_ARB_render_texture
54 extern PFNWGLBINDTEXIMAGEARBPROC wglBindTexImageARB;
55 extern PFNWGLRELEASETEXIMAGEARBPROC wglReleaseTexImageARB;
56 extern PFNWGLSETPBUFFERATTRIBARBPROC wglSetPbufferAttribARB;
59 #define MAX_OSPATH 256
61 #define WINDOW_STYLE (WS_OVERLAPPED|WS_BORDER|WS_CAPTION|WS_VISIBLE | WS_THICKFRAME)
63 void Sys_QueEvent( int time, sysEventType_t type, int value, int value2, int ptrLength, void *ptr );
65 void Sys_CreateConsole( void );
66 void Sys_DestroyConsole( void );
68 char *Sys_ConsoleInput (void);
69 char *Sys_GetCurrentUser( void );
71 void Win_SetErrorText( const char *text );
73 cpuid_t Sys_GetCPUId( void );
81 void IN_Shutdown (void);
82 // add additional non keyboard / non mouse movement on top of the keyboard move cmd
84 void IN_DeactivateMouseIfWindowed( void );
85 void IN_DeactivateMouse( void );
86 void IN_ActivateMouse( void );
88 void IN_Frame( void );
90 int IN_DIMapKey( int key );
92 void DisableTaskKeys( BOOL bDisable, BOOL bBeep, BOOL bTaskMgr );
96 LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
98 void Conbuf_AppendText( const char *msg );
104 bool activeApp; // changed with WM_ACTIVATE messages
105 bool mouseReleased; // when the game has the console down or is doing a long operation
106 bool movingWindow; // inhibit mouse grab when dragging the window
107 bool mouseGrabbed; // current state of grab and hide
109 OSVERSIONINFOEX osversion;
113 // when we get a windows message, we store the time off so keyboard processing
114 // can know the exact time of an event (not really needed now that we use async direct input)
117 bool windowClassRegistered;
121 HDC hDC; // handle to device context
122 HGLRC hGLRC; // handle to GL rendering context
123 PIXELFORMATDESCRIPTOR pfd;
126 HINSTANCE hinstOpenGL; // HINSTANCE for the OpenGL library
128 int desktopBitsPixel;
129 int desktopWidth, desktopHeight;
135 unsigned short oldHardwareGamma[3][256];
136 // desktop gamma is saved here for restoration at exit
138 static idCVar sys_arch;
139 static idCVar sys_cpustring;
140 static idCVar in_mouse;
141 static idCVar win_allowAltTab;
142 static idCVar win_notaskkeys;
143 static idCVar win_username;
144 static idCVar win_xpos; // archived X coordinate of window position
145 static idCVar win_ypos; // archived Y coordinate of window position
146 static idCVar win_outputDebugString;
147 static idCVar win_outputEditString;
148 static idCVar win_viewlog;
149 static idCVar win_timerUpdate;
150 static idCVar win_allowMultipleInstances;
152 CRITICAL_SECTION criticalSections[MAX_CRITICAL_SECTIONS];
153 HANDLE backgroundDownloadSemaphore;
155 HINSTANCE hInstDI; // direct input
157 LPDIRECTINPUT8 g_pdi;
158 LPDIRECTINPUTDEVICE8 g_pMouse;
159 LPDIRECTINPUTDEVICE8 g_pKeyboard;
161 HANDLE renderCommandsEvent;
162 HANDLE renderCompletedEvent;
163 HANDLE renderActiveEvent;
164 HANDLE renderThreadHandle;
165 unsigned long renderThreadId;
166 void (*glimpRenderThread)( void );
169 // SMP acceleration vars
173 extern Win32Vars_t win32;
175 #endif /* !__WIN_LOCAL_H__ */