@Hitokiri~ Happens to all of us : ) ..most small values are upcast to int32/64 anyway...I do the same thing.
P.S. NEVER just check if( GetAsyncKeyState() ) as the value returned could evaluate to true
even though the key wasn't pressed. ( Check MSDN )
I think you mean
P.S. NEVER just check if( GetAsyncKeyState() ) as the value returned could evaluate to true even though the key
[isn't currently down]'. ? ( Check MSDN )
maybe?
ie. where msdn says "was pressed after the previous call to getasynckeystate. ? If so, that's good advice..because msdn says not to rely on it, but in this case; doing the action on Key_UP, it could only help us (ie. pretend that because of thread timing we don't catch the key in the down state..but the 'pressedSinceLastCall' bit gets set, so we will be aware of the keypress). Again, msdn says not to rely on this, but in the case of doing the action on key_up, it can only help, so I'd leave it. I think.
-----------------------
@hiimachicken1
Code:
if (GetAsyncKeyState(VK_F1))
{ //key is currently down
wasKeyDown = true;
}
else
{//key isn't currently down, but was it down a moment ago?!
if (wasKeyDown)
{
//do the thing
mem.Write(0x4807B5, (BYTE)117);
wasKeyDown = false; //have to reset it..
}
}
could be shortened to:
Code:
if (GetAsyncKeyState(VK_F1))
{ //key is currently down
wasKeyDown = true;
}
else if (wasKeyDown) //key isn't currently down, but was it down a moment ago?!
{
mem.Write(0x4807B5, (BYTE)117);
wasKeyDown = false; //have to reset it..
}
exactly the same thing, but slightly cleaner, imo.