Original Post
hello,
what''s the best way to handle keys when programming a game?
so far i always did it this way in the main message loop:
( saw it at nehe )
if(keys[''C''] && !c_pressed) {
c_pressed=true;
//...do something here
}
if(!keys[''C'']) {
c_pressed=false;
}
but this is getting kinda annoying cause i need one extra variable for each key and this is only processed once every frame. so if the framerate is very low, chances are good the keypressing isnt realised at all.
also, i dont know if this is the usual way to do it at all.
how do you do it?
thanks!