gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Clearing keypress input

#28759 - Starman - Fri Nov 05, 2004 4:49 pm

Hi all,
So far, I've been working on my own little project with nothing but the tutorials on the web, and some ideas here. It's been going well so far. I have this little issue which I haven't found a solution for. I have a splash screen. When it comes up, just like in other games, it says "Press Start" but the "A" button will start the game also. Common practice in games. The thing is, when the "A" button is pressed, the splash screen goes away, the playfield is drawn, and the GBA acts as if the user pressed "A" and fires a missle. So it looks like the input carried over from the time the key was pressed to when the playfield was drawn. The thing is, I haven't found too much info on how to CLEAR key inputs. I did add a "WaitForVBlank()" to be sure that everything's timed right. So why would this keypress carry over like that? Thanks.

Mike

#28762 - tepples - Fri Nov 05, 2004 5:10 pm

Please read the answer to the question "How do I detect single button taps instead of continuous presses?" in the FAQ.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#28763 - poslundc - Fri Nov 05, 2004 5:10 pm

You can't really clear key inputs per se. It's up to you to keep track of how long a key has been pressed down for and whether it's been released, is a new press, etc. This usually means maintaining some kind of state information; read up on deterministic finite state machines.

Dan.

Edit: Or do what tepples suggests.

#28765 - Starman - Fri Nov 05, 2004 5:28 pm

tepples wrote:
Please read the answer to the question "How do I detect single button taps instead of continuous presses?" in the FAQ.


Pfft. You'd think I'd know that since I deal with that in MFC and OS X all the time using mouse clicks (detecting "button up"). I was thinking along the lines that the registers handled keypresses differently. Thanks.

Mike