DOOM-3-BFG

DOOM 3 BFG Edition
Log | Files | Refs

win_local.h (5495B)


      1 /*
      2 ===========================================================================
      3 
      4 Doom 3 BFG Edition GPL Source Code
      5 Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. 
      6 
      7 This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").  
      8 
      9 Doom 3 BFG Edition 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 BFG Edition 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 BFG Edition Source Code.  If not, see <http://www.gnu.org/licenses/>.
     21 
     22 In addition, the Doom 3 BFG Edition 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 BFG Edition 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/OpenGL/wglext.h"		// windows OpenGL extensions
     34 #include "win_input.h"
     35 
     36 // WGL_ARB_extensions_string
     37 extern	PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
     38 
     39 // WGL_EXT_swap_interval
     40 extern	PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
     41 
     42 // WGL_ARB_pixel_format
     43 extern	PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribivARB;
     44 extern	PFNWGLGETPIXELFORMATATTRIBFVARBPROC wglGetPixelFormatAttribfvARB;
     45 extern	PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB;
     46 
     47 // WGL_ARB_pbuffer
     48 extern	PFNWGLCREATEPBUFFERARBPROC	wglCreatePbufferARB;
     49 extern	PFNWGLGETPBUFFERDCARBPROC	wglGetPbufferDCARB;
     50 extern	PFNWGLRELEASEPBUFFERDCARBPROC	wglReleasePbufferDCARB;
     51 extern	PFNWGLDESTROYPBUFFERARBPROC	wglDestroyPbufferARB;
     52 extern	PFNWGLQUERYPBUFFERARBPROC	wglQueryPbufferARB;
     53 
     54 // WGL_ARB_render_texture 
     55 extern	PFNWGLBINDTEXIMAGEARBPROC		wglBindTexImageARB;
     56 extern	PFNWGLRELEASETEXIMAGEARBPROC	wglReleaseTexImageARB;
     57 extern	PFNWGLSETPBUFFERATTRIBARBPROC	wglSetPbufferAttribARB;
     58 
     59 #define	WINDOW_STYLE	(WS_OVERLAPPED|WS_BORDER|WS_CAPTION|WS_VISIBLE | WS_THICKFRAME)
     60 
     61 void	Sys_QueEvent( sysEventType_t type, int value, int value2, int ptrLength, void *ptr, int inputDeviceNum );
     62 
     63 void	Sys_CreateConsole();
     64 void	Sys_DestroyConsole();
     65 
     66 char	*Sys_ConsoleInput ();
     67 char	*Sys_GetCurrentUser();
     68 
     69 void	Win_SetErrorText( const char *text );
     70 
     71 cpuid_t	Sys_GetCPUId();
     72 
     73 // Input subsystem
     74 
     75 void	IN_Init ();
     76 void	IN_Shutdown ();
     77 // add additional non keyboard / non mouse movement on top of the keyboard move cmd
     78 
     79 void	IN_DeactivateMouseIfWindowed();
     80 void	IN_DeactivateMouse();
     81 void	IN_ActivateMouse();
     82 
     83 void	IN_Frame();
     84 
     85 void	DisableTaskKeys( BOOL bDisable, BOOL bBeep, BOOL bTaskMgr );
     86 
     87 uint64 Sys_Microseconds();
     88 
     89 // window procedure
     90 LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
     91 
     92 void Conbuf_AppendText( const char *msg );
     93 
     94 typedef struct {
     95 	HWND			hWnd;
     96 	HINSTANCE		hInstance;
     97 
     98 	bool			activeApp;			// changed with WM_ACTIVATE messages
     99 	bool			mouseReleased;		// when the game has the console down or is doing a long operation
    100 	bool			movingWindow;		// inhibit mouse grab when dragging the window
    101 	bool			mouseGrabbed;		// current state of grab and hide
    102 
    103 	OSVERSIONINFOEX	osversion;
    104 
    105 	cpuid_t			cpuid;
    106 
    107 	// when we get a windows message, we store the time off so keyboard processing
    108 	// can know the exact time of an event (not really needed now that we use async direct input)
    109 	int				sysMsgTime;
    110 
    111 	bool			windowClassRegistered;
    112 
    113 	WNDPROC			wndproc;
    114 
    115 	HDC				hDC;							// handle to device context
    116 	HGLRC			hGLRC;						// handle to GL rendering context
    117 	PIXELFORMATDESCRIPTOR pfd;		
    118 	int				pixelformat;
    119 
    120 	HINSTANCE		hinstOpenGL;	// HINSTANCE for the OpenGL library
    121 
    122 	int				desktopBitsPixel;
    123 	int				desktopWidth, desktopHeight;
    124 
    125 	int				cdsFullscreen;	// 0 = not fullscreen, otherwise monitor number
    126 
    127 	idFileHandle	log_fp;
    128 
    129 	unsigned short	oldHardwareGamma[3][256];
    130 	// desktop gamma is saved here for restoration at exit
    131 
    132 	static idCVar	sys_arch;
    133 	static idCVar	sys_cpustring;
    134 	static idCVar	in_mouse;
    135 	static idCVar	win_allowAltTab;
    136 	static idCVar	win_notaskkeys;
    137 	static idCVar	win_username;
    138 	static idCVar	win_outputEditString;
    139 	static idCVar	win_viewlog;
    140 	static idCVar	win_timerUpdate;
    141 	static idCVar	win_allowMultipleInstances;
    142 
    143 	CRITICAL_SECTION criticalSections[MAX_CRITICAL_SECTIONS];
    144 
    145 	HINSTANCE		hInstDI;			// direct input
    146 
    147 	LPDIRECTINPUT8			g_pdi;
    148 	LPDIRECTINPUTDEVICE8	g_pMouse;
    149 	LPDIRECTINPUTDEVICE8	g_pKeyboard;
    150 	idJoystickWin32			g_Joystick;
    151 
    152 	HANDLE			renderCommandsEvent;
    153 	HANDLE			renderCompletedEvent;
    154 	HANDLE			renderActiveEvent;
    155 	HANDLE			renderThreadHandle;
    156 	unsigned long	renderThreadId;
    157 	void			(*glimpRenderThread)();
    158 	void			*smpData;
    159 	int				wglErrors;
    160 	// SMP acceleration vars
    161 
    162 } Win32Vars_t;
    163 
    164 extern Win32Vars_t	win32;
    165 
    166 #endif /* !__WIN_LOCAL_H__ */