Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: Key Repeat in Windows  (Read 757 times)

frier

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 4
    • View Profile
Key Repeat in Windows
« on: June 30, 2010, 10:24:49 AM »

Was reading through the forums and saw OIS didn't have a key repeat feature for windows. So I'm looking into coding it myself for my player movement. Because at the moment to move the camera forward you have to press 'W' over and over. (actually maybe I could just implement it so when keyReleased triggers then I stop moving, instead of when the button is down, for every 30 millisecond tick, move forward)

So I started implementing the timer so it repeats say every 30 milliseconds. But now I'm up to the part where, how do I tell OIS to fire my keyPressed function in my EventHandler if the button is still pressed?

Also am I right to think that the capture() in the OIS Object checks if input has changed then fires my eventHander? I could also use the copyKeyStates function for the keyboard and write my own lil event handler with keyrepeats. What do you guys recommend?
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Re: Key Repeat in Windows
« Reply #1 on: July 03, 2010, 09:02:43 PM »

I don't recommend injecting keys into OIS. It is simply not designed for that. Your first guess, is actually the best way to handle it. Simply use a value to apply to your movement every update frame that is triggered from keypresses/keyreleases. Key repeats would not help with this, repeats are mainly only useful for text input.
Logged