Failed attempt at better inputs

This commit is contained in:
octospacc 2022-08-05 12:45:28 +02:00
parent a45706bd34
commit 21bc35baec
1 changed files with 11 additions and 5 deletions

View File

@ -300,6 +300,9 @@ void KeyListen() {
if ( Keys [KeyUp] ) {
UsedKeys.Up = 1;
}
if ( Keys [KeyDown] ) {
UsedKeys.Down = 1;
}
}
int main( int argc, char* args[] ) {
@ -319,10 +322,13 @@ int main( int argc, char* args[] ) {
while ( !Quit ) {
NextTickTime = SDL_GetTicks() + GameTick;
while ( SDL_PollEvent( & Event ) ) {
Recalc = true;
//Recalc = true;
if ( Event.type == SDL_QUIT ) {
Quit = true;
}
else if ( Event.type == SDL_KEYDOWN ) {
Recalc = true;
}
else if ( Event.type == SDL_KEYUP ) {
if ( Event.key.keysym.sym == KeyEsc ) {
if ( InGame && !InInventory ) {
@ -355,7 +361,7 @@ int main( int argc, char* args[] ) {
UsedKeys.Right = true;
}
else if ( Event.key.keysym.sym == KeyDown ) {
UsedKeys.Down = true;
//UsedKeys.Down = true;
}
else if ( Event.key.keysym.sym == KeyLeft ) {
UsedKeys.Left = true;
@ -374,12 +380,12 @@ int main( int argc, char* args[] ) {
}
}
}
if ( InputTickTime % ( GameTick*3 ) == 0 ) {
KeyListen();
if ( InputTickTime % ( GameTick*4 ) == 0 ) {
EventHandle();
//Recalc = false;
}
if ( Recalc ) {
KeyListen();
FillSurfRGB ( 0xFF, 0xFF, 0xFF, Screen );
if ( InGame && !InInventory ) {
SetCamera();