I've seen a few posts about this and tried to implement them but none of them seem to allow my eventreciever to catch when F10 is pressed. Seen this post but wasn't sure where in the file to add the code http://irrlicht.sourceforge.net/phpBB2/ ... hlight=f10
I just want to be able to tell when F10 is Pressed!
Using irrlicht 1.3.1
Windows Vista
F10 in Windows
-
- Posts: 89
- Joined: Thu Aug 17, 2006 8:11 pm
- Location: Salt Lake City, UT, USA
- Contact:
F10 in Windows
Definition of an Upgrade: Take old bugs out, put new ones in.
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
-
- Posts: 89
- Joined: Thu Aug 17, 2006 8:11 pm
- Location: Salt Lake City, UT, USA
- Contact:
That's Great!!!!!
between that and this post I have put this together to fix the prob. Maybe they can be built into the next release?
in CIrrDeviceWin32.cpp
add
to the enf of line
then in your main loop i added
with this just before the main loop
for this to work you must include windows.h
between that and this post I have put this together to fix the prob. Maybe they can be built into the next release?
in CIrrDeviceWin32.cpp
add
Code: Select all
|| wParam == SC_KEYMENU
Code: Select all
if ((wParam & 0xFFF0) == SC_SCREENSAVE ||
(wParam & 0xFFF0) == SC_MONITORPOWER)
Code: Select all
if(GetAsyncKeyState(VK_F10)!=f10)
{
f10=GetAsyncKeyState(VK_F10);
SEvent ev;
ev.EventType= irr::EET_KEY_INPUT_EVENT;
ev.KeyInput.Char=0;
ev.KeyInput.PressedDown=(f10<0);
ev.KeyInput.Key=irr::KEY_F10;
device->getEventReceiver()->OnEvent(ev);
}
Code: Select all
short f10=GetAsyncKeyState(VK_F10);
Definition of an Upgrade: Take old bugs out, put new ones in.
What you'd need to do to get it to work like you'd expect would be to add support for WM_SYSKEYUP and WM_SYSKEYDOWN messages. That will also get the left and right ALT keys to work as expected. Unfortunately if you fix this, ALT+F4 stops working because Irrlicht will intercept all keyboard input before the default window handler gets a chance. Of course you can overcome that by providing your own way for the program to exit.
Travis
Code: Select all
// in CIrrDeviceWin32.cpp
case WM_SYSKEYDOWN: // added
case WM_KEYDOWN:
{
// snip...
return 0;
}
case WM_SYSKEYUP: // added
case WM_KEYUP:
{
// snip...
return 0;
}
// snip...
case WM_SYSCOMMAND:
// prevent screensaver or monitor powersave mode from starting
if ((wParam & 0xFFF0) == SC_SCREENSAVE ||
(wParam & 0xFFF0) == SC_MONITORPOWER)
{
return 0;
}
else if ((wParam & 0xFFF0) == SC_KEYMENU) // added
{
return 0;
}
break;
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
Absolutely. The only thing I'm saying is that you have to handle the message yourself where Irrlicht used to do it for you. If you have a program that uses the FPS camera and run it using a 'fixed' Irrlicht.dll, you'll have a hard time getting out of the program. You'll probably end up getting the task manager and killing it that way.
Travis
Travis