Posix: Fix a few warnings in ctrlssdl.cpp

This commit is contained in:
Emmanuel Gil Peyrot 2020-12-25 03:08:16 +01:00
parent ac507ebdc0
commit aeaf404177
1 changed files with 12 additions and 9 deletions

View File

@ -272,8 +272,8 @@ static void set_mouse_coord(signed long x,signed long y)
} }
// Adapted from Windows port // Adapted from Windows port
bool allowUpAndDown = false; static bool allowUpAndDown = false;
static buttonstruct<int> cardinalHeldTime = {0}; static buttonstruct<int> cardinalHeldTime = {};
static void RunAntipodalRestriction(const buttonstruct<bool>& pad) static void RunAntipodalRestriction(const buttonstruct<bool>& pad)
{ {
@ -291,17 +291,19 @@ static void ApplyAntipodalRestriction(buttonstruct<bool>& pad)
return; return;
// give preference to whichever direction was most recently pressed // give preference to whichever direction was most recently pressed
if(pad.U && pad.D) if (pad.U && pad.D) {
if (cardinalHeldTime.U < cardinalHeldTime.D) if (cardinalHeldTime.U < cardinalHeldTime.D)
pad.D = false; pad.D = false;
else else
pad.U = false; pad.U = false;
if(pad.L && pad.R) }
if (pad.L && pad.R) {
if (cardinalHeldTime.L < cardinalHeldTime.R) if (cardinalHeldTime.L < cardinalHeldTime.R)
pad.R = false; pad.R = false;
else else
pad.L = false; pad.L = false;
} }
}
/* Update NDS keypad */ /* Update NDS keypad */
void update_keypad(u16 keys) void update_keypad(u16 keys)
@ -466,7 +468,7 @@ process_joystick_events( u16 *keypad) {
} }
} }
u16 shift_pressed; static u16 shift_pressed;
void void
process_ctrls_event( SDL_Event& event, process_ctrls_event( SDL_Event& event,
@ -576,6 +578,7 @@ process_ctrls_event( SDL_Event& event,
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
if(event.button.button==1) if(event.button.button==1)
mouse.down = TRUE; mouse.down = TRUE;
break;
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
if(!mouse.down) if(!mouse.down)