Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: OIS and Key Release  (Read 564 times)

Gouwi

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
    • View Profile
OIS and Key Release
« on: April 18, 2010, 07:54:21 AM »

Hello everyone !  :D
Firstly, I would like to ask you apoligies on my poor level of English, I'm french = D
I'm new in this forum and my first topic deals with a problem i have.

I'm using the Ogre Rendering Engine. I'm using OIS for keyboard and mouse input.
I want to get the key released event. When you released a key, for example KC_A, i want my application play a music. While you press the key, there is nothing but when you released it, the music is playing. But, in the keyboard methods, there isn't a method for a Released Key, there is only a method (isKeyDown) to get the state of a key.  ???

Someone has an idea to help me ?  ;D
Again sorry for my poor English skills. In french -> Encore désolé pour mon piètre niveau en anglais.

^^

Salutations Distinguées

Gouwi
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: OIS and Key Release
« Reply #1 on: April 18, 2010, 08:04:22 AM »

In your key listener, override keyReleased.
Logged

Gouwi

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
    • View Profile
Re: OIS and Key Release
« Reply #2 on: April 18, 2010, 08:10:12 AM »

Yes =D But no  ;)
In fact, i don't use any framelistener  ::)

               :o

Yes ... I know this is not good but i don't want to use it !

Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: OIS and Key Release
« Reply #3 on: April 18, 2010, 09:40:53 AM »

Well, then you have to call isKeyDown every frame then. If it is not pressed (released) it will be false. If it is pressed, it will be true. If you want notifications for when this happens, you have to use the listeners.
Logged