Beginning Game Programmer, Question about GetKeys()

Post: #1
I have a question regarding GetKeys();
When I use it to move a sprite back and forth across the screen, the keys that I press for control (4 for left, 6 for right), are also typed into my CodeWarrior editor window wherever the cursor is. For instance:


Right now it is no more than an annoyance, but I want to know if it could cause some problems when more than one program is open in the final game, and if it is possible to fix this. Thanks!
Quote this message in a reply
Posts: 145
Joined: 2002.06
Post: #2
It sounds like you need to call FlushEvents() before your app exits. Usually keyDown+keyUp+mouseDown+mouseUp is a good event mask to use.

Beat you! Neener Neener Neener Neener.

"He who breaks a thing to find out what it is, has left the path of wisdom."
- Gandalf the Gray-Hat

Bring Alistair Cooke's America to DVD!
Quote this message in a reply
Posts: 304
Joined: 2002.04
Post: #3
Since you are using getkeys - you are not actually pulling events off of the event queue - so all those key down events are still there for whatever app comes front next. Try adding

FlushEvents( everyEvent, 0 );

before your app quits.

Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Transition from programmer to video game programmer <book suggestions> Achithyn 12 10,846 May 28, 2006 12:13 PM
Last Post: Achithyn
  How to use GetKeys() xDexx 6 6,788 Mar 19, 2003 01:37 AM
Last Post: NCarter