event on key release

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
bearSoft
Posts: 165
Joined: Fri Apr 01, 2005 9:55 pm
Location: Denmark

event on key release

Post by bearSoft »

hello
is it posible to get an event when a keyboard key is released
ty.
Regards.
Tech: win98se| 320mb ram| abitbe6| 433mhzceleron| atiRadeon7000.64mb| soundblaster125| dx9.0b | devCPP | IRR 0.12.0 |
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

I recommend reading the tutorials

http://irrlicht.sourceforge.net/tutorials.html

especially this one:

http://irrlicht.sourceforge.net/tut004.html

There key-up events are processed.
It is like it is. And because it is like it is, things are like they are.
bearSoft
Posts: 165
Joined: Fri Apr 01, 2005 9:55 pm
Location: Denmark

Post by bearSoft »

ty but that wont do
i use

Code: Select all

if(event.EventType == irr::EET_KEY_INPUT_EVENT)
{
   keys[event.KeyInput.Key] = event.KeyInput.PressedDown; 
}
to be able to use a more generalized reciver -simply put i do not want any action in the reciever code -it ought to be an external class with total transparency regarding the action in the main part
putting motion etc in the reciver is not a good thing (OOP wise)
i simply want a boolean state change when the keys in the key-array is inactive -eg 'up'
Regards.
Tech: win98se| 320mb ram| abitbe6| 433mhzceleron| atiRadeon7000.64mb| soundblaster125| dx9.0b | devCPP | IRR 0.12.0 |
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

then you're also also going to have to keep a bool key_changed[] array and set it to true for a key that just changed. You'll have to make sure your update function sets all the flags to false at the end of an update.

Personally, I dont like this idea- instead I use the EventReciever class to pipe events into my current game state object, so an event can be handled when its generated. see ICE 3.0 for more details
a screen cap is worth 0x100000 DWORDS
bearSoft
Posts: 165
Joined: Fri Apr 01, 2005 9:55 pm
Location: Denmark

Post by bearSoft »

ty. both -as for now i use a 'compromize' sort of..
in the reciver (std irr) i only make a state change -then i let the behaviour depend on the state- with this i can still have the event implemented outside the reciever
-not 'good' but reasonably functionallity ;(

-Next step: use a timer as udater for the behaviour
endresult : semiautomatic shooting
Regards.
Tech: win98se| 320mb ram| abitbe6| 433mhzceleron| atiRadeon7000.64mb| soundblaster125| dx9.0b | devCPP | IRR 0.12.0 |
Post Reply