Advertisement

Curious Win32 problem

Started by July 13, 2004 03:13 PM
0 comments, last by markjh 20 years, 4 months ago
I have just implemented a console in my game engine. The problem I am having is that whenever I type a 'p' in the console the program switches from fullscreen mode. The trigger for fullscreen mode is F1, so it is quite confisg. This is how it is setup: This is the fullscreen code:

while(!done)
{
...blah blah...
  if (keys[VK_F1]) // Is F1 Being Pressed?
  {
	keys[VK_F1]=FALSE;
	KillGLWindow();		     
        fullscreen=!fullscreen;
	if (!CreateGLWindow("Luckybob's Demo",640,480,16,fullscreen))
        {return 0;}
  }
}
this is how the console gets key pressed info:

case WM_CHAR:
{
  if(console.is_open)
    console.keyPress(wParam);
}
case WM_KEYDOWN:							
{
  keys[wParam] = TRUE;
  if(console.is_open)
    console.translateKey(wParam, true);
  return 0;								
}
case WM_KEYUP:									{			
  keys[wParam] = FALSE;	
  if(console.is_open)
    console.translateKey(wParam, false);
  return 0;								
}
Nothing in the console code refers to the fullscreen mode during parsing. If I comment out the F1 key, it doesn't happen. Any clues? Thanks, dimebag
In your WM_KEYDOWN handler, you need to check for an "extended key" for the Fx keys, if I remember correctly. VK_F1 is defined as 0x70, which is in fact ASCII for "p". So, for WM_KEYDOWN, you'll need to check lParam's bit 24 (according to the MSDN).

This topic is closed to new replies.

Advertisement