From 21bc35baecb13c032a81431e6c99ff1733790887 Mon Sep 17 00:00:00 2001 From: octospacc Date: Fri, 5 Aug 2022 12:45:28 +0200 Subject: [PATCH] Failed attempt at better inputs --- Source/Main.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Source/Main.c b/Source/Main.c index 1b4ac36..6f5b29c 100644 --- a/Source/Main.c +++ b/Source/Main.c @@ -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();