While a couple methods that should work have been mentioned, the simplest method, IMHO is just this:
if (keys[VK_SPACE]){
player.engine = !player.engine
keys[VK_SPACE]=FALSE;
}
This should work fine with Nehe''s OpenGL I/O stuff, and doesn''t add any unnecessary variables.
keyboard problem
you're all unreasonable, here's my solution for Direct Input finally:
finally, can move on to something else
Edited by - vbisme on August 23, 2000 5:39:18 PM
#define KeyDown(KS, DIKey) (KS[DIKey] & 0x80)#define KeyUp(KS, DIKey) (!(KS[DIKey] & 0x80))while (KeyDown(KeyState, DIK_P)){///Get KeyStateif (FAILED(lpDIDeviceKeyboard->GetDeviceState(sizeof(KeyState), (LPVOID)&KeyState))){return(0);}//end ifif (KeyUp(KeyState, DIK_P)){if (PauseState){ PauseState = false;}else{ PauseState = true;}//end if}//end if}//end whileif (PauseState){Pause();}else{RunGame();}//end if
finally, can move on to something else
Edited by - vbisme on August 23, 2000 5:39:18 PM
congratulations vbisme...
cygon, sorry if i said that you are wrong and pis** you off with that..peace..btw i newer said that keys[VK_SPACE] is a function, c mon man...i mentioned KeyDown(KeyState, DIK_P) that looks like function but in fact is "#define KEYDOWN(name,key) (name[key] & 0x80)", kinda preprocessor function
have fun
cygon, sorry if i said that you are wrong and pis** you off with that..peace..btw i newer said that keys[VK_SPACE] is a function, c mon man...i mentioned KeyDown(KeyState, DIK_P) that looks like function but in fact is "#define KEYDOWN(name,key) (name[key] & 0x80)", kinda preprocessor function
have fun
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement