sdl: fix hat button names
This commit is contained in:
parent
7d57d55414
commit
5b7d189058
|
@ -269,19 +269,33 @@ public:
|
||||||
}
|
}
|
||||||
if (bind.bindType == SDL_CONTROLLER_BINDTYPE_HAT && (code >> 8) - 1 == (u32)bind.value.hat.hat)
|
if (bind.bindType == SDL_CONTROLLER_BINDTYPE_HAT && (code >> 8) - 1 == (u32)bind.value.hat.hat)
|
||||||
{
|
{
|
||||||
switch (bind.value.hat.hat_mask)
|
int hat;
|
||||||
|
const char *name;
|
||||||
|
switch (code & 0xff)
|
||||||
{
|
{
|
||||||
case SDL_HAT_UP:
|
case 0:
|
||||||
return "DPad Up";
|
hat = SDL_HAT_UP;
|
||||||
case SDL_HAT_DOWN:
|
name = "DPad Up";
|
||||||
return "DPad Down";
|
break;
|
||||||
case SDL_HAT_LEFT:
|
case 1:
|
||||||
return "DPad Left";
|
hat = SDL_HAT_DOWN;
|
||||||
case SDL_HAT_RIGHT:
|
name = "DPad Down";
|
||||||
return "DPad Right";
|
break;
|
||||||
|
case 2:
|
||||||
|
hat = SDL_HAT_LEFT;
|
||||||
|
name = "DPad Left";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
hat = SDL_HAT_RIGHT;
|
||||||
|
name = "DPad Right";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
|
hat = 0;
|
||||||
|
name = nullptr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (hat == bind.value.hat.hat_mask)
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -378,6 +392,6 @@ public:
|
||||||
loadMapping();
|
loadMapping();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAbsPos(int x, int y);
|
void setAbsPos(int x, int y);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue