X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=vid_wgl.c;h=afb773f5d97c8df395ce5e11e4be285cf74d29d8;hp=11eea0e26b890a9a54a7751134116f72c03d2725;hb=aa33d8f8642530f7f266d6cde1422f95aa74b2be;hpb=7da3f74c75363169da55547a5758a10735352b95 diff --git a/vid_wgl.c b/vid_wgl.c index 11eea0e2..afb773f5 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -19,6 +19,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // gl_vidnt.c -- NT GL vid component +// we don't need a very new dinput +#define DIRECTINPUT_VERSION 0x0300 + #include "quakedef.h" #include #include @@ -78,7 +81,6 @@ static qboolean vid_initialized = false; static qboolean vid_wassuspended = false; static qboolean vid_usingmouse = false; static qboolean vid_usingvsync = false; -static qboolean vid_usemouse = false; static qboolean vid_usevsync = false; static HICON hIcon; @@ -260,6 +262,8 @@ static void IN_StartupMouse (void); void VID_Finish (void) { + qboolean vid_usemouse; + vid_usevsync = vid_vsync.integer && !cls.timedemo && gl_videosyncavailable; if (vid_usingvsync != vid_usevsync && gl_videosyncavailable) { @@ -473,6 +477,7 @@ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) char state[256]; char asciichar[4]; int vkey; + int charlength; qboolean down = false; if ( uMsg == uiWheelMessage ) @@ -503,8 +508,12 @@ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) GetKeyboardState (state); // alt/ctrl/shift tend to produce funky ToAscii values, // and if it's not a single character we don't know care about it - if (vkey == K_ALT || vkey == K_CTRL || vkey == K_SHIFT || ToAscii (wParam, lParam >> 16, state, (unsigned short *)asciichar, 0) != 1) + charlength = ToAscii (wParam, lParam >> 16, state, (unsigned short *)asciichar, 0); + if (vkey == K_ALT || vkey == K_CTRL || vkey == K_SHIFT || charlength == 0) asciichar[0] = 0; + else if( charlength == 2 ) { + asciichar[0] = asciichar[1]; + } Key_Event (vkey, asciichar[0], down); break; @@ -689,7 +698,7 @@ void VID_Init(void) wc.lpszClassName = "DarkPlacesWindowClass"; if (!RegisterClass (&wc)) - Sys_Error("Couldn't register window class\n"); + Con_Printf ("Couldn't register window class\n"); IN_Init(); } @@ -900,14 +909,14 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp) return false; } - qglGetString = GL_GetProcAddress("glGetString"); - qwglGetExtensionsStringARB = GL_GetProcAddress("wglGetExtensionsStringARB"); - if (qglGetString == NULL) + if ((qglGetString = (const GLubyte* (GLAPIENTRY *)(GLenum name))GL_GetProcAddress("glGetString")) == NULL) { VID_Shutdown(); Con_Print("glGetString not found\n"); return false; } + if ((qwglGetExtensionsStringARB = (const char *(WINAPI *)(HDC hdc))GL_GetProcAddress("wglGetExtensionsStringARB")) == NULL) + Con_Print("wglGetExtensionsStringARB not found\n"); gl_renderer = qglGetString(GL_RENDERER); gl_vendor = qglGetString(GL_VENDOR); gl_version = qglGetString(GL_VERSION); @@ -945,6 +954,13 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp) IN_StartupMouse (); IN_StartupJoystick (); + if (gl_videosyncavailable) + { + vid_usevsync = vid_vsync.integer; + vid_usingvsync = vid_vsync.integer; + qwglSwapIntervalEXT (vid_usevsync); + } + return true; }