win_local.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code 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
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. 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.
  17. 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.
  18. ===========================================================================
  19. */
  20. #ifndef __WIN_LOCAL_H__
  21. #define __WIN_LOCAL_H__
  22. #include <windows.h>
  23. #include "../../renderer/wglext.h" // windows OpenGL extensions
  24. // WGL_ARB_extensions_string
  25. extern PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
  26. // WGL_EXT_swap_interval
  27. extern PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
  28. // WGL_ARB_pixel_format
  29. extern PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribivARB;
  30. extern PFNWGLGETPIXELFORMATATTRIBFVARBPROC wglGetPixelFormatAttribfvARB;
  31. extern PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB;
  32. // WGL_ARB_pbuffer
  33. extern PFNWGLCREATEPBUFFERARBPROC wglCreatePbufferARB;
  34. extern PFNWGLGETPBUFFERDCARBPROC wglGetPbufferDCARB;
  35. extern PFNWGLRELEASEPBUFFERDCARBPROC wglReleasePbufferDCARB;
  36. extern PFNWGLDESTROYPBUFFERARBPROC wglDestroyPbufferARB;
  37. extern PFNWGLQUERYPBUFFERARBPROC wglQueryPbufferARB;
  38. // WGL_ARB_render_texture
  39. extern PFNWGLBINDTEXIMAGEARBPROC wglBindTexImageARB;
  40. extern PFNWGLRELEASETEXIMAGEARBPROC wglReleaseTexImageARB;
  41. extern PFNWGLSETPBUFFERATTRIBARBPROC wglSetPbufferAttribARB;
  42. #define MAX_OSPATH 256
  43. #define WINDOW_STYLE (WS_OVERLAPPED|WS_BORDER|WS_CAPTION|WS_VISIBLE | WS_THICKFRAME)
  44. void Sys_QueEvent( int time, sysEventType_t type, int value, int value2, int ptrLength, void *ptr );
  45. void Sys_CreateConsole( void );
  46. void Sys_DestroyConsole( void );
  47. char *Sys_GetCurrentUser( void );
  48. void Win_SetErrorText( const char *text );
  49. cpuid_t Sys_GetCPUId( void );
  50. int MapKey (int key);
  51. // Input subsystem
  52. void IN_Init (void);
  53. void IN_Shutdown (void);
  54. // add additional non keyboard / non mouse movement on top of the keyboard move cmd
  55. void IN_DeactivateMouseIfWindowed( void );
  56. void IN_DeactivateMouse( void );
  57. void IN_ActivateMouse( void );
  58. void IN_Frame( void );
  59. int IN_DIMapKey( int key );
  60. void DisableTaskKeys( BOOL bDisable, BOOL bBeep, BOOL bTaskMgr );
  61. // window procedure
  62. LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  63. void Conbuf_AppendText( const char *msg );
  64. typedef struct {
  65. HWND hWnd;
  66. HINSTANCE hInstance;
  67. bool activeApp; // changed with WM_ACTIVATE messages
  68. bool mouseReleased; // when the game has the console down or is doing a long operation
  69. bool movingWindow; // inhibit mouse grab when dragging the window
  70. bool mouseGrabbed; // current state of grab and hide
  71. OSVERSIONINFOEX osversion;
  72. cpuid_t cpuid;
  73. // when we get a windows message, we store the time off so keyboard processing
  74. // can know the exact time of an event (not really needed now that we use async direct input)
  75. int sysMsgTime;
  76. bool windowClassRegistered;
  77. WNDPROC wndproc;
  78. HDC hDC; // handle to device context
  79. HGLRC hGLRC; // handle to GL rendering context
  80. PIXELFORMATDESCRIPTOR pfd;
  81. int pixelformat;
  82. HINSTANCE hinstOpenGL; // HINSTANCE for the OpenGL library
  83. int desktopBitsPixel;
  84. int desktopWidth, desktopHeight;
  85. bool cdsFullscreen;
  86. FILE *log_fp;
  87. unsigned short oldHardwareGamma[3][256];
  88. // desktop gamma is saved here for restoration at exit
  89. static idCVar sys_arch;
  90. static idCVar sys_cpustring;
  91. static idCVar in_mouse;
  92. static idCVar win_allowAltTab;
  93. static idCVar win_notaskkeys;
  94. static idCVar win_username;
  95. static idCVar win_xpos; // archived X coordinate of window position
  96. static idCVar win_ypos; // archived Y coordinate of window position
  97. static idCVar win_outputDebugString;
  98. static idCVar win_outputEditString;
  99. static idCVar win_viewlog;
  100. static idCVar win_timerUpdate;
  101. static idCVar win_allowMultipleInstances;
  102. CRITICAL_SECTION criticalSections[MAX_CRITICAL_SECTIONS];
  103. HANDLE backgroundDownloadSemaphore;
  104. HINSTANCE hInstDI; // direct input
  105. LPDIRECTINPUT8 g_pdi;
  106. LPDIRECTINPUTDEVICE8 g_pMouse;
  107. LPDIRECTINPUTDEVICE8 g_pKeyboard;
  108. HANDLE renderCommandsEvent;
  109. HANDLE renderCompletedEvent;
  110. HANDLE renderActiveEvent;
  111. HANDLE renderThreadHandle;
  112. unsigned long renderThreadId;
  113. void (*glimpRenderThread)( void );
  114. void *smpData;
  115. int wglErrors;
  116. // SMP acceleration vars
  117. } Win32Vars_t;
  118. extern Win32Vars_t win32;
  119. #endif /* !__WIN_LOCAL_H__ */