[Help]Declaring Keystrokes

Posts 1–7 of 7 · Page 1 of 1
[Help]Declaring Keystrokes
Code:
		if(key_stroke == 61)
		{
			boxes = !boxes;
		}

I have a bunch of these but when I build it gives me an error saying that

Code:
 error C2065: 'key_stroke' : undeclared identifier
All my keystrokes are from the ascii chart so they're correct.
Nvm that's for Async not for key_stroke = ***
Quote Originally Posted by Shaadow View Post
Nvm that's for Async not for key_stroke = ***
GetAsyncKeyState is similar to keystroke. Just do like

[php]

if(GetAsyncKeyState(VK_NUMPAD1)<0)
{
boxes = !boxes;
}

[/php]

Same thing.
Quote Originally Posted by Jason View Post


GetAsyncKeyState is similar to keystroke. Just do like

[php]

if(GetAsyncKeyState(VK_NUMPAD1)<0)
{
boxes = !boxes;
}

[/php]

Same thing.
Not really, GetAsyncKeySate is doing the following code while that key is being pressed. (as long as the code is in a loop)

Key_Stroke does the following code if the following key was pressed. I just taught myself the while loop
Quote Originally Posted by VvITylerIvV View Post
Not really, GetAsyncKeySate is doing the following code while that key is being pressed. (as long as the code is in a loop)

Key_Stroke does the following code if the following key was pressed. I just taught myself the while loop
No, GetAsyncKeyState even during a loop just continuously checks the keystate, if it's pressed down: do the following, otherwise nothing happens, it's the same as Key_stroke

I think
[php]
if(GetAsyncKeyState(VK_KEEEEY)&1)
{
}
[/php]

Checks for a single keypress in C++
Quote Originally Posted by Jason View Post


No, GetAsyncKeyState even during a loop just continuously checks the keystate, if it's pressed down: do the following, otherwise nothing happens, it's the same as Key_stroke

I think
[php]
if(GetAsyncKeyState(VK_KEEEEY)&1)
{
}
[/php]

Checks for a single keypress in C++
ahh, so GetAsyncKeySate and Key_Stroke are the same thing? just GetAsyncKeyState is a better, more common code?
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us