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