Problem with KEY_SNAPSHOT

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Scarabol
Posts: 167
Joined: Sat Jan 03, 2009 5:26 pm
Location: Aachen, Germany

Problem with KEY_SNAPSHOT

Post by Scarabol »

Hi,

the Key-Code for the Screenshot Button should be KEY_SNAPSHOT, right?

Im using MastEventReceiver

Code: Select all

long tmp = event.KeyInput.key;
// debug tmp -> tmp = 44 or 2c in hex, which is KEY_SNAPSHOT in keycodes.h

Code: Select all

if (receiver.keyPressed(KEY_SNAPSHOT))
printf("doesnt work");
if (receiver.keyPressed(KEY_KEY_A))
pritnf("works well");
Whats gone wrong?

MfG
Scarabol
Mel
Competition winner
Posts: 2293
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Post by Mel »

Not necesarilly, although maybe there is a key named like that you can use ANY key to grab a snapshot. Take a peek to the Demo source, as it has an snapshot system integrated in it. Its key is the F9, for instance.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Scarabol
Posts: 167
Joined: Sat Jan 03, 2009 5:26 pm
Location: Aachen, Germany

Post by Scarabol »

Well i'm sorry i dont want ANY key i want THIS key...

MfG
Scarabol
CuteAlien
Admin
Posts: 10062
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

You probably want KEY_PRINT. I don't know what the SNAPSHOT key does - according to MS documentation it is for "PRINT SCREEN key for Windows 3.0 and later", but my print screen key does just send PRINT and not SNAPSHOT events.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Scarabol
Posts: 167
Joined: Sat Jan 03, 2009 5:26 pm
Location: Aachen, Germany

Post by Scarabol »

Print has no effect, too.

Pls try it for yourself just use example 16 Quake Map Shader with another key code for Key_F9 and send me your results.

I tried:
F9 - works well
Print - nothing happens
Snapshot - nothing happens

MfG
Scarabol
CuteAlien
Admin
Posts: 10062
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Hm, I can only test on linux right now, but maybe it's the same. It seem the key-down message is never received by the application - only the key-up. Not sure right now why that is the case and if it's avoidable. Usually it's not a good idea to use system-keys for application behaviour, so maybe just switch to another key.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Scarabol
Posts: 167
Joined: Sat Jan 03, 2009 5:26 pm
Location: Aachen, Germany

Post by Scarabol »

Hi,

key-down message never reach my eventreceiver...
key-up message do???

Seems to be a ....... BUG!!!!! RED ALERT!

MfG
Scarabol
CuteAlien
Admin
Posts: 10062
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Well, I guess we can't pass on messages which we don't get and we do not filter that message out. So it seems like the OS does already filter that message, not much we can do there.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Scarabol
Posts: 167
Joined: Sat Jan 03, 2009 5:26 pm
Location: Aachen, Germany

Post by Scarabol »

How do Irrlicht get the key states?

GetAsyncKeyState(#VK_SNAPSHOT) works well on my system...

MfG
Scarabol
CuteAlien
Admin
Posts: 10062
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Irrlicht does pass on the system messsages WM_KEYDOWN and WM_SYSKEYDOWN. VK_SNAPSHOT is not delivered with those. The alternative would be installing a key-hook. We might do that maybe (for other reasons) at some time. You are certainly free to use GetAsyncKeyState to find out the current state.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply