what is wrong with this?
#define KeyUp(data, n) ((data[n] & 0x80) ? false : true)
unsigned char key[256];
bool keyDown = false;
bool Input::getKeyPressed(unsigned char KEY)
{
if(KeyUp(key,KEY))
return false;
return true;
}
//code to check to see if they pressed it once
bool ButtonAndKey::KeyPressUp(unsigned char Key)
{
if(g_engine->getInput()->getKeyPressed(Key) && !keyDown)
{
keyDown = true;
}
if(!g_engine->getInput()->getKeyPressed(Key) && keyDown)
{
keyDown = false;
return true;
}
return false;
}
here is what i am using it with
if(bk->KeyPressUp(DIK_F1))
PostQuitMessage( 0 );
if(bk->KeyPressUp(DIK_GRAVE))
Error("Debug Console");
when i hit the ` key it does the PostQuitMessage and when i hit F1 it gives me the messagebox.
so my question is this. WHY ARE THE REVERSED?