Beginning Game Programmer, Question about GetKeys()
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!
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!
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.
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!
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
before your app quits.
hth,
Codemattic
Code:
FlushEvents( everyEvent, 0 );before your app quits.
hth,
Codemattic
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Transition from programmer to video game programmer <book suggestions> | Achithyn | 12 | 4,964 |
May 28, 2006 12:13 PM Last Post: Achithyn |
|
| How to use GetKeys() | xDexx | 6 | 3,877 |
Mar 19, 2003 01:37 AM Last Post: NCarter |
|

