• Advertisement

Archived

This topic is now archived and is closed to further replies.

about input

This topic is 6385 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hot could I handle keyboard input, it must support multiple keys pressed at same time.I am using PTC if that helps.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
windows, dos, linux, beos? gotta expand there man. Dos, just use the scan codes(lookem up, there out there), and getch, or use dos interrupts and write a simple assembly handler. windows 32bit app, just use the message handler for KEYDOWN event and the getasynchronous function. You cant us dos interrupts for keyboard input in assembly language under windows 32bit protected apps, big time crash. PTC, no, that doesnt help, all i know is that ptc is a graphics library or something, but not sure how it handles keyboard routines.

Share this post


Link to post
Share on other sites
Ok, Im using Windows, MSVC++ 6
No OpenGL, no Direct3D.
And assembly...I know nothing about assembly.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement