Beginning Game Programmer, Question about GetKeys()

Why37
Unregistered
 
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:

GetKeys(theKeyboard);46664646446646

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
Member
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.

edit:
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
Member
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

Code:
FlushEvents( everyEvent, 0 );


before your app quits.

hth,
Codemattic
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 5,364 May 28, 2006 12:13 PM
Last Post: Achithyn
  How to use GetKeys() xDexx 6 4,159 Mar 19, 2003 01:37 AM
Last Post: NCarter