mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 01:29:43 +01:00
Make left/right key input correct for RTL menus
Instead of just up/down, you can also control menus with left/right. Which is illogical in Arabic... No big deal, I imagined this code to become much worse than it did. (And action sets is probably gonna refactor the whole thing anyway)
This commit is contained in:
parent
2b22f7cda2
commit
25bdf0866a
2 changed files with 50 additions and 6 deletions
|
@ -249,11 +249,11 @@ void Graphics::map_tab(int opt, const char* text, bool selected /*= false*/)
|
|||
{
|
||||
char buffer[SCREEN_WIDTH_CHARS + 1];
|
||||
vformat_buf(buffer, sizeof(buffer), loc::get_langmeta()->menu_select_tight.c_str(), "label:str", text);
|
||||
font::print(PR_CEN | PR_CJK_LOW, x, 220, buffer, 196, 196, 255 - help.glow);
|
||||
font::print(PR_CEN | PR_CJK_LOW | PR_RTL_XFLIP, x, 220, buffer, 196, 196, 255 - help.glow);
|
||||
}
|
||||
else
|
||||
{
|
||||
font::print(PR_CEN | PR_CJK_LOW, x, 220, text, 64, 64, 64);
|
||||
font::print(PR_CEN | PR_CJK_LOW | PR_RTL_XFLIP, x, 220, text, 64, 64, 64);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2289,11 +2289,33 @@ void titleinput(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (key.isDown(KEYBOARD_LEFT) || key.isDown(KEYBOARD_UP) || key.isDown(KEYBOARD_a) || key.isDown(KEYBOARD_w) || key.controllerWantsLeft(true))
|
||||
SDL_Keycode left, right, a, d;
|
||||
bool controller_up = key.controllerWantsUp();
|
||||
bool controller_down = key.controllerWantsDown();
|
||||
if (!font::is_rtl(PR_FONT_INTERFACE))
|
||||
{
|
||||
left = KEYBOARD_LEFT;
|
||||
right = KEYBOARD_RIGHT;
|
||||
a = KEYBOARD_a;
|
||||
d = KEYBOARD_d;
|
||||
controller_up |= key.controllerWantsLeft(false);
|
||||
controller_down |= key.controllerWantsRight(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
left = KEYBOARD_RIGHT;
|
||||
right = KEYBOARD_LEFT;
|
||||
a = KEYBOARD_d;
|
||||
d = KEYBOARD_a;
|
||||
controller_up |= key.controllerWantsRight(false);
|
||||
controller_down |= key.controllerWantsLeft(false);
|
||||
}
|
||||
|
||||
if (key.isDown(left) || key.isDown(KEYBOARD_UP) || key.isDown(a) || key.isDown(KEYBOARD_w) || controller_up)
|
||||
{
|
||||
game.press_left = true;
|
||||
}
|
||||
if (key.isDown(KEYBOARD_RIGHT) || key.isDown(KEYBOARD_DOWN) || key.isDown(KEYBOARD_d) || key.isDown(KEYBOARD_s) || key.controllerWantsRight(true))
|
||||
if (key.isDown(right) || key.isDown(KEYBOARD_DOWN) || key.isDown(d) || key.isDown(KEYBOARD_s) || controller_down)
|
||||
{
|
||||
game.press_right = true;
|
||||
}
|
||||
|
@ -3019,11 +3041,33 @@ void mapinput(void)
|
|||
&& ((!version2_2 && !game.fadetomenu && game.fadetomenudelay <= 0 && !game.fadetolab && game.fadetolabdelay <= 0)
|
||||
|| graphics.fademode == FADE_NONE))
|
||||
{
|
||||
if (key.isDown(KEYBOARD_LEFT) || key.isDown(KEYBOARD_UP) || key.isDown(KEYBOARD_a) || key.isDown(KEYBOARD_w)|| key.controllerWantsLeft(true))
|
||||
SDL_Keycode left, right, a, d;
|
||||
bool controller_up = key.controllerWantsUp();
|
||||
bool controller_down = key.controllerWantsDown();
|
||||
if (!font::is_rtl(PR_FONT_INTERFACE))
|
||||
{
|
||||
left = KEYBOARD_LEFT;
|
||||
right = KEYBOARD_RIGHT;
|
||||
a = KEYBOARD_a;
|
||||
d = KEYBOARD_d;
|
||||
controller_up |= key.controllerWantsLeft(false);
|
||||
controller_down |= key.controllerWantsRight(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
left = KEYBOARD_RIGHT;
|
||||
right = KEYBOARD_LEFT;
|
||||
a = KEYBOARD_d;
|
||||
d = KEYBOARD_a;
|
||||
controller_up |= key.controllerWantsRight(false);
|
||||
controller_down |= key.controllerWantsLeft(false);
|
||||
}
|
||||
|
||||
if (key.isDown(left) || key.isDown(KEYBOARD_UP) || key.isDown(a) || key.isDown(KEYBOARD_w)|| controller_up)
|
||||
{
|
||||
game.press_left = true;
|
||||
}
|
||||
if (key.isDown(KEYBOARD_RIGHT) || key.isDown(KEYBOARD_DOWN) || key.isDown(KEYBOARD_d) || key.isDown(KEYBOARD_s)|| key.controllerWantsRight(true))
|
||||
if (key.isDown(right) || key.isDown(KEYBOARD_DOWN) || key.isDown(d) || key.isDown(KEYBOARD_s)|| controller_down)
|
||||
{
|
||||
game.press_right = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue