]> icculus.org git repositories - icculus/iodoom3.git/blob - neo/sys/win32/win_local.h
Various Mac OS X tweaks to get this to build. Probably breaking things.
[icculus/iodoom3.git] / neo / sys / win32 / win_local.h
1 /*
2 ===========================================================================
3
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 
6
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).  
8
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.
13
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.
18
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/>.
21
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.
23
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.
25
26 ===========================================================================
27 */
28
29 #ifndef __WIN_LOCAL_H__
30 #define __WIN_LOCAL_H__
31
32 #include <windows.h>
33 #include "../../renderer/wglext.h"              // windows OpenGL extensions
34
35 // WGL_ARB_extensions_string
36 extern  PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
37
38 // WGL_EXT_swap_interval
39 extern  PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
40
41 // WGL_ARB_pixel_format
42 extern  PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribivARB;
43 extern  PFNWGLGETPIXELFORMATATTRIBFVARBPROC wglGetPixelFormatAttribfvARB;
44 extern  PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB;
45
46 // WGL_ARB_pbuffer
47 extern  PFNWGLCREATEPBUFFERARBPROC      wglCreatePbufferARB;
48 extern  PFNWGLGETPBUFFERDCARBPROC       wglGetPbufferDCARB;
49 extern  PFNWGLRELEASEPBUFFERDCARBPROC   wglReleasePbufferDCARB;
50 extern  PFNWGLDESTROYPBUFFERARBPROC     wglDestroyPbufferARB;
51 extern  PFNWGLQUERYPBUFFERARBPROC       wglQueryPbufferARB;
52
53 // WGL_ARB_render_texture 
54 extern  PFNWGLBINDTEXIMAGEARBPROC               wglBindTexImageARB;
55 extern  PFNWGLRELEASETEXIMAGEARBPROC    wglReleaseTexImageARB;
56 extern  PFNWGLSETPBUFFERATTRIBARBPROC   wglSetPbufferAttribARB;
57
58
59 #define MAX_OSPATH                      256
60
61 #define WINDOW_STYLE    (WS_OVERLAPPED|WS_BORDER|WS_CAPTION|WS_VISIBLE | WS_THICKFRAME)
62
63 void    Sys_QueEvent( int time, sysEventType_t type, int value, int value2, int ptrLength, void *ptr );
64
65 void    Sys_CreateConsole( void );
66 void    Sys_DestroyConsole( void );
67
68 char    *Sys_ConsoleInput (void);
69 char    *Sys_GetCurrentUser( void );
70
71 void    Win_SetErrorText( const char *text );
72
73 cpuid_t Sys_GetCPUId( void );
74
75 int             MapKey (int key);
76
77
78 // Input subsystem
79
80 void    IN_Init (void);
81 void    IN_Shutdown (void);
82 // add additional non keyboard / non mouse movement on top of the keyboard move cmd
83
84 void    IN_DeactivateMouseIfWindowed( void );
85 void    IN_DeactivateMouse( void );
86 void    IN_ActivateMouse( void );
87
88 void    IN_Frame( void );
89
90 int             IN_DIMapKey( int key );
91
92 void    DisableTaskKeys( BOOL bDisable, BOOL bBeep, BOOL bTaskMgr );
93
94
95 // window procedure
96 LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
97
98 void Conbuf_AppendText( const char *msg );
99
100 typedef struct {
101         HWND                    hWnd;
102         HINSTANCE               hInstance;
103
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
108
109         OSVERSIONINFOEX osversion;
110
111         cpuid_t                 cpuid;
112
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)
115         int                             sysMsgTime;
116
117         bool                    windowClassRegistered;
118
119         WNDPROC                 wndproc;
120
121         HDC                             hDC;                                                    // handle to device context
122         HGLRC                   hGLRC;                                          // handle to GL rendering context
123         PIXELFORMATDESCRIPTOR pfd;              
124         int                             pixelformat;
125
126         HINSTANCE               hinstOpenGL;    // HINSTANCE for the OpenGL library
127
128         int                             desktopBitsPixel;
129         int                             desktopWidth, desktopHeight;
130
131         bool                    cdsFullscreen;
132
133         FILE                    *log_fp;
134
135         unsigned short  oldHardwareGamma[3][256];
136         // desktop gamma is saved here for restoration at exit
137
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;
151
152         CRITICAL_SECTION criticalSections[MAX_CRITICAL_SECTIONS];
153         HANDLE                  backgroundDownloadSemaphore;
154
155         HINSTANCE               hInstDI;                        // direct input
156
157         LPDIRECTINPUT8                  g_pdi;
158         LPDIRECTINPUTDEVICE8    g_pMouse;
159         LPDIRECTINPUTDEVICE8    g_pKeyboard;
160
161         HANDLE                  renderCommandsEvent;
162         HANDLE                  renderCompletedEvent;
163         HANDLE                  renderActiveEvent;
164         HANDLE                  renderThreadHandle;
165         unsigned long   renderThreadId;
166         void                    (*glimpRenderThread)( void );
167         void                    *smpData;
168         int                             wglErrors;
169         // SMP acceleration vars
170
171 } Win32Vars_t;
172
173 extern Win32Vars_t      win32;
174
175 #endif /* !__WIN_LOCAL_H__ */