Direction Key Help
Hey everyone. I am currently making a little "game" (I use that word loosely ). And I don''t want to touch DX yet... And I need to know how to code the ASCII code (or whatever) to get my program to recognize that they are being pressed... So, can someone please help me? Thnx in advance! ^_^
------------------------------
The Shining Knight
You could check the Windows Message Handler for WM_KEYDOWN messages. If there is one, check which key it is using CASE then call the appropriate code. You can do the same for WM_KEYUP (key released) messages.
Sorry - I can't get you an example right now, but you can at least look up Windows Messages / Message Handlers in the compiler help - that should get you started.
Paulcoz.
Edited by - paulcoz on January 10, 2001 8:15:45 PM
Sorry - I can't get you an example right now, but you can at least look up Windows Messages / Message Handlers in the compiler help - that should get you started.
Paulcoz.
Edited by - paulcoz on January 10, 2001 8:15:45 PM
quote:
And I don''t want to touch DX yet... And I need to know how to code the ASCII code (or whatever) to get my program to recognize that they are being pressed...
Ah, I know EXACTLY where you''re coming from -- and let me tell you: crime doesn''t pay...
Anyway, UP, DOWN, LEFT, and RIGHT are strange 4-bit ASCII codes or something, so they aren''t accessible through standard or extended ASCII character codes. No way to just throw a
if ( kbhit() ) { getch() == UP_ARROW moveUp(); // and there was much rejoicing }
Believe you me, I spent a good half my summer (well, maybe a few days) figuring out there''s no way.
Use W, A, D, and S. They are the next-most-standard thing to the arrow keys.
-----------------
The Goblin
-----------------
"Oh, God..."
"Yes?" <- My Response
- The Goblin (madgob@aol.com)
Heh heh heh. The previous code example doesn''t even make sense. I''m tired.
Well, about as much sense as the exchange between my brother and I:
Him: "Wow, I''d like to wash a hat with this..."
Me: (menacingly)"Oh yeah? Well I''d like to wash YOU -- Wait, NO!"
-----------------
The Goblin
-----------------
"Oh, God..."
"Yes?" <- My Response
Well, about as much sense as the exchange between my brother and I:
Him: "Wow, I''d like to wash a hat with this..."
Me: (menacingly)"Oh yeah? Well I''d like to wash YOU -- Wait, NO!"
-----------------
The Goblin
-----------------
"Oh, God..."
"Yes?" <- My Response
- The Goblin (madgob@aol.com)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement