Skip to main content
gamedev.net
🔒 Locked

about input

Started by Caereth Aug 26, 2000 at 6:58 PM 4 replies 200+ views
Original Post
Caereth
Caereth
Hot could I handle keyboard input, it must support multiple keys pressed at same time.I am using PTC if that helps.
Caereth
Caereth
Ok, Im using Windows, MSVC++ 6
No OpenGL, no Direct3D.
And assembly...I know nothing about assembly.
Quantum
Quantum
test for key down:
#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)

and just in case you want it, test for key up:
#define KEY_UP (vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)

use like so:

if(KEY_DOWN(VK_CODE))
something;

eg

if(KEY_DOWN(VK_RIGHT))
player_x++;

you get the idea
Caereth
Caereth
Thanks a lot!
I will try it right now.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.