Sign in to follow this  
SelethD

keyboard input

Recommended Posts

I need to read keypresses for my game when inputing the players name, and I dont know how to do it in windows.
FAR PASCAL cApp::MsgProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
	Mouse.UpdateButtons(msg);


	switch (msg)
	{
		//Key Pressed
		case WM_KEYDOWN: 
		{
        	  playername[location]=wparam;
		}break;

	}
	return DefWindowProc(hwnd,msg,wparam,lparam);
}


when doing it this way, all the keys are in upper case, and there is no lower case I thought there was a command like GETANSIKEY or somthing that sounded like that. Anyone know how to do this in Windows? EDIT: Can anyone tell me how to do source tags? EDIT: Ok, got source tags in, thanks [Edited by - SelethD on September 3, 2004 10:03:14 PM]

Share this post


Link to post
Share on other sites
you use GetAsyncKeyState(VK_(the key you want in all caps)) this isnt a bool value but rather a 1 or 0 thing so youll have to do something like
if ((VK_LEFT) < 0)

{
//do something crazy
};

hope i helped

i think by source tags you mean

[ source ]
[ /source ]

with no spaces in those boxes (i think thats what you mean)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this