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