You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please
read the bug posting guidelines first.
chromdragon
Posts: 101 Joined: Wed Feb 15, 2006 4:22 pm
Location: RO
Post
by chromdragon » Tue Feb 28, 2006 12:53 pm
Code: Select all
bool OnEvent(SEvent event)
{
bool alt_key;
if (event.KeyInput.PressedDown == true && event.KeyInput.Key == KEY_MENU )
{
alt_key = true;
printf("alt_key %d\n", alt_key);
}
else if (event.KeyInput.PressedDown != true && event.KeyInput.Key == KEY_MENU)
{
alt_key = false;
printf("alt_key %d\n", alt_key);
}
}
letters and controls work ok!
vitek
Bug Slayer
Posts: 3919 Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR
Post
by vitek » Tue Feb 28, 2006 6:07 pm
The WinProc isn't handling WM_SYSKEYUP/DOWN messages. Without that I don't think you'll ever get alt key handling. The window and menu keys work just fine though. The code below can be used to convince you of that.
Code: Select all
virtual bool OnEvent(SEvent event)
{
if ( event.EventType == EET_KEY_INPUT_EVENT )
{
printf("key %#0.2x %d\n", event.KeyInput.Key, event.KeyInput.PressedDown);
}
return false;
}
vitek
Bug Slayer
Posts: 3919 Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR
Post
by vitek » Tue Feb 28, 2006 6:51 pm
You will have to test this a little more, but I think you'd be okay if you changed CIrrDeviceWin32.cpp like this...
Code: Select all
case WM_SYSKEYDOWN: // added
case WM_KEYDOWN:
{
event.EventType = irr::EET_KEY_INPUT_EVENT;
event.KeyInput.Key = (irr::EKEY_CODE)wParam;
event.KeyInput.PressedDown = true;
// snip
return 0;
}
case WM_SYSKEYUP: // added
case WM_KEYUP:
{
event.EventType = irr::EET_KEY_INPUT_EVENT;
event.KeyInput.Key = (irr::EKEY_CODE)wParam;
event.KeyInput.PressedDown = false;
// snip
return 0;
}