mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-09 18:39:45 +01:00
Touch input menu
This commit is contained in:
parent
e96d1391cd
commit
3bdeaf8ed3
3 changed files with 48 additions and 19 deletions
|
@ -7024,6 +7024,15 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
||||||
option(loc::gettext("return"));
|
option(loc::gettext("return"));
|
||||||
menuyoff = 0;
|
menuyoff = 0;
|
||||||
maxspacing = 15;
|
maxspacing = 15;
|
||||||
|
|
||||||
|
auto_buttons = false;
|
||||||
|
|
||||||
|
touch::create_slider_button((320 - 160) / 2, 120 + 32, 160, 48, loc::gettext("ui scale"), &touch::scale, 5, 20);
|
||||||
|
|
||||||
|
touch::create_menu_button(46 - 16, 200, 76, 26, loc::gettext("previous"), -2);
|
||||||
|
touch::create_menu_button(122, 200, 76, 26, loc::gettext("return"), 2);
|
||||||
|
touch::create_menu_button(198 + 16, 200, 76, 26, loc::gettext("next"), -1);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Menu::language:
|
case Menu::language:
|
||||||
if (loc::languagelist.empty())
|
if (loc::languagelist.empty())
|
||||||
|
|
|
@ -1190,7 +1190,7 @@ void menuactionpress(void)
|
||||||
}
|
}
|
||||||
if (game.currentmenuoption == -1)
|
if (game.currentmenuoption == -1)
|
||||||
{
|
{
|
||||||
// audio menu
|
// touch input menu
|
||||||
music.playef(Sound_VIRIDIAN);
|
music.playef(Sound_VIRIDIAN);
|
||||||
game.createmenu(Menu::touch_input, true);
|
game.createmenu(Menu::touch_input, true);
|
||||||
map.nexttowercolour();
|
map.nexttowercolour();
|
||||||
|
@ -2045,6 +2045,18 @@ void menuactionpress(void)
|
||||||
case Menu::touch_input:
|
case Menu::touch_input:
|
||||||
switch (game.currentmenuoption)
|
switch (game.currentmenuoption)
|
||||||
{
|
{
|
||||||
|
case -2:
|
||||||
|
// audio menu
|
||||||
|
music.playef(Sound_VIRIDIAN);
|
||||||
|
game.createmenu(Menu::audiooptions, true);
|
||||||
|
map.nexttowercolour();
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
// accessibility menu
|
||||||
|
music.playef(Sound_VIRIDIAN);
|
||||||
|
game.createmenu(Menu::accessibility, true);
|
||||||
|
map.nexttowercolour();
|
||||||
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
music.playef(Sound_CRY);
|
music.playef(Sound_CRY);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -801,27 +801,35 @@ static void menurender(void)
|
||||||
}
|
}
|
||||||
case Menu::touch_input:
|
case Menu::touch_input:
|
||||||
{
|
{
|
||||||
switch (game.currentmenuoption)
|
if (key.using_touch)
|
||||||
{
|
{
|
||||||
case 0: // Control style
|
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Touch Input"), tr, tg, tb);
|
||||||
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Control Style"), tr, tg, tb);
|
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Change touch input options."), tr, tg, tb);
|
||||||
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Change the control style for touch input."), tr, tg, tb);
|
}
|
||||||
break;
|
else
|
||||||
case 1:
|
{
|
||||||
// Display touch buttons!
|
switch (game.currentmenuoption)
|
||||||
key.using_touch = true;
|
{
|
||||||
|
case 0: // Control style
|
||||||
|
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Control Style"), tr, tg, tb);
|
||||||
|
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Change the control style for touch input."), tr, tg, tb);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
// Display touch buttons!
|
||||||
|
key.using_touch = true;
|
||||||
|
|
||||||
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("UI Scale"), tr, tg, tb);
|
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("UI Scale"), tr, tg, tb);
|
||||||
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Change the scale of the UI buttons."), tr, tg, tb);
|
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Change the scale of the UI buttons."), tr, tg, tb);
|
||||||
|
|
||||||
char buffer[SCREEN_WIDTH_CHARS + 1];
|
char buffer[SCREEN_WIDTH_CHARS + 1];
|
||||||
float scale = (float)touch::scale / 10.0;
|
float scale = (float) touch::scale / 10.0;
|
||||||
vformat_buf(buffer, sizeof(buffer), loc::gettext("Current scale: {scale}.{extra}x"), "scale:int, extra:int",
|
vformat_buf(buffer, sizeof(buffer), loc::gettext("Current scale: {scale}.{extra}x"), "scale:int, extra:int",
|
||||||
(int) scale,
|
(int)scale,
|
||||||
(int) ((float) ((float) scale - (int) scale) * 10)
|
(int)((float)((float)scale - (int)scale) * 10)
|
||||||
);
|
);
|
||||||
font::print(PR_CEN, -1, 75, buffer, tr, tg, tb);
|
font::print(PR_CEN, -1, 75, buffer, tr, tg, tb);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue