1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-05 18:59:41 +01:00

Accessibility menu

This commit is contained in:
NyakoFox 2024-04-10 13:11:19 -03:00
parent f061bfa66b
commit c914eeb3ed
3 changed files with 117 additions and 67 deletions

View file

@ -6949,8 +6949,13 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
break;
}
case Menu::accessibility:
{
int offset = -1;
#if !defined(MAKEANDPLAY)
option(loc::gettext("unlock play modes"));
// For now, we're not going to allow the player to unlock play modes from the options menu, until we come up with a good UI for it.
//touch::create_menu_button((320 - 160) / 2, 120 - 32, 160, 26, loc::gettext("unlock play modes"), 0);
offset = 0;
#endif
option(loc::gettext("invincibility"), !ingame_titlemode || !incompetitive());
option(loc::gettext("slowdown"), !ingame_titlemode || !incompetitive());
@ -6961,8 +6966,19 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
menuyoff = 0;
maxspacing = 15;
buttonscentered = true;
auto_buttons = false;
touch::create_toggle_button((320 - 160) / 2, 120 - 24 - 8, 160, 12, loc::gettext("invincibility"), offset + 1, map.invincibility);
touch::create_slider_button((320 - 160) / 2, 120 - 16, 160, 48, loc::gettext("game speed"), &slowdown, 12, 30);
touch::create_toggle_button((320 - 160) / 2, 120 + 32, 160, 12, loc::gettext("animated backgrounds"), offset + 3, !colourblindmode);
touch::create_toggle_button((320 - 160) / 2, 120 + 48, 160, 12, loc::gettext("screen effects"), offset + 4, !noflashingmode);
touch::create_toggle_button((320 - 160) / 2, 120 + 64, 160, 12, loc::gettext("text outline"), offset + 5, !graphics.notextoutline);
touch::create_menu_button(46 - 16, 200, 76, 26, loc::gettext("previous"), -2);
touch::create_menu_button(122, 200, 76, 26, loc::gettext("return"), offset + 6);
touch::create_menu_button(198 + 16, 200, 76, 26, loc::gettext("next"), -1);
break;
}
case Menu::controller:
option(loc::gettext("analog stick sensitivity"));
option(loc::gettext("bind flip"));
@ -6983,7 +6999,9 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
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((320 - 160) / 2, 120 - 32, 160, 26, loc::gettext("control style"), 1, false);
touch::create_slider_button((320 - 160) / 2, 120 + 16, 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);
@ -6991,6 +7009,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
break;
case Menu::language:
auto_buttons = false;
if (loc::languagelist.empty())
{
option(loc::gettext("ok"));
@ -7017,6 +7036,11 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
menuyoff = 70-(menuoptions.size()*10);
maxspacing = 5;
}
touch::create_menu_button(46 - 16, 200, 76, 26, loc::gettext("previous"), -2);
touch::create_menu_button(122, 200, 76, 26, loc::gettext("return"), -3);
touch::create_menu_button(198 + 16, 200, 76, 26, loc::gettext("next"), -1);
break;
case Menu::translator_main:
option(loc::gettext("translator options"));
@ -7115,6 +7139,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
option(loc::gettext("no, return to options"));
option(loc::gettext("yes, enable"));
menuyoff = 64;
buttonyoff = -24;
break;
case Menu::setslowdown:
option(loc::gettext("normal speed"));
@ -7301,7 +7326,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
{
option(loc::gettext("secret lab"));
}
option(loc::gettext("play modes"));
option(loc::gettext("play modes"), true, PR_RTL_XFLIP, false); // Disable an auto button for play modes for now, we haven't done the menu
if (save_exists())
{
option(loc::gettext("new game"));
@ -7331,6 +7356,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
option(loc::gettext("start new game"));
option(loc::gettext("return"));
menuyoff = 64;
buttonyoff = -16;
break;
case Menu::playmodes:
option(loc::gettext("time trials"), !nocompetitive_unless_translator());
@ -7500,10 +7526,11 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
{
if (menuoptions[i].auto_button)
{
int button_width = SDL_max(160, font::len(menuoptions[i].print_flags, menuoptions[i].text) + 16);
touch::create_menu_button(
(320 - 160) / 2,
(320 - button_width) / 2,
base_y + offset * (button_height + button_spacing),
160,
button_width,
button_height,
menuoptions[i].text,
i,

View file

@ -896,6 +896,21 @@ void menuactionpress(void)
break;
case Menu::accessibility:
{
if (game.currentmenuoption == -2)
{
// touch menu
music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::touch_input, true);
map.nexttowercolour();
}
if (game.currentmenuoption == -1)
{
// language menu
music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::language, true);
map.nexttowercolour();
}
int accessibilityoffset = 0;
#if !defined(MAKEANDPLAY)
accessibilityoffset = 1;

View file

@ -1220,89 +1220,97 @@ static void menurender(void)
break;
case Menu::accessibility:
{
if (key.using_touch)
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Accessibility"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Disable screen effects, enable slowdown modes or invincibility."), tr, tg, tb);
}
else
{
#ifdef MAKEANDPLAY
#define OFFSET 0
#else
#define OFFSET 1
#endif
switch (game.currentmenuoption)
{
switch (game.currentmenuoption)
{
#if !defined(MAKEANDPLAY)
case 0:
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Unlock Play Modes"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Unlock parts of the game normally unlocked as you progress."), tr, tg, tb);
break;
case 0:
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Unlock Play Modes"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Unlock parts of the game normally unlocked as you progress."), tr, tg, tb);
break;
#endif
case OFFSET+0:
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Invincibility"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Explore the game freely without dying. (Can cause glitches.)"), tr, tg, tb);
if (map.invincibility)
case OFFSET + 0:
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Invincibility is ON."), tr, tg, tb);
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Invincibility"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Explore the game freely without dying. (Can cause glitches.)"), tr, tg, tb);
if (map.invincibility)
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Invincibility is ON."), tr, tg, tb);
}
else
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Invincibility is OFF."), tr / 2, tg / 2, tb / 2);
}
break;
}
else
case OFFSET + 1:
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Invincibility is OFF."), tr / 2, tg / 2, tb / 2);
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Slowdown"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Reduce the game speed."), tr, tg, tb);
drawslowdowntext(next_y);
break;
}
break;
}
case OFFSET+1:
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Slowdown"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Reduce the game speed."), tr, tg, tb);
drawslowdowntext(next_y);
break;
}
case OFFSET+2:
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Backgrounds"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Disable animated backgrounds in menus and during gameplay."), tr, tg, tb);
if (!game.colourblindmode)
case OFFSET + 2:
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Backgrounds are ON."), tr, tg, tb);
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Backgrounds"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Disable animated backgrounds in menus and during gameplay."), tr, tg, tb);
if (!game.colourblindmode)
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Backgrounds are ON."), tr, tg, tb);
}
else
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Backgrounds are OFF."), tr / 2, tg / 2, tb / 2);
}
break;
}
else
case OFFSET + 3:
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Backgrounds are OFF."), tr / 2, tg / 2, tb / 2);
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Screen Effects"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Disables screen shakes and flashes."), tr, tg, tb);
if (!game.noflashingmode)
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Screen Effects are ON."), tr, tg, tb);
}
else
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Screen Effects are OFF."), tr / 2, tg / 2, tb / 2);
}
break;
}
break;
}
case OFFSET+3:
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Screen Effects"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Disables screen shakes and flashes."), tr, tg, tb);
if (!game.noflashingmode)
case OFFSET + 4:
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Screen Effects are ON."), tr, tg, tb);
}
else
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Screen Effects are OFF."), tr / 2, tg / 2, tb / 2);
}
break;
}
case OFFSET+4:
{
const char* text;
const char* text;
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Text Outline"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Disables outline on game text."), tr, tg, tb);
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Text Outline"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Disables outline on game text."), tr, tg, tb);
graphics.fill_rect(0, next_y-4, 320, 16, tr, tg, tb);
graphics.fill_rect(0, next_y - 4, 320, 16, tr, tg, tb);
if (!graphics.notextoutline)
{
text = loc::gettext("Text outlines are ON.");
if (!graphics.notextoutline)
{
text = loc::gettext("Text outlines are ON.");
}
else
{
text = loc::gettext("Text outlines are OFF.");
}
font::print(PR_BOR | PR_CEN, -1, next_y, text, 255, 255, 255);
break;
}
else
{
text = loc::gettext("Text outlines are OFF.");
}
font::print(PR_BOR | PR_CEN, -1, next_y, text, 255, 255, 255);
break;
}
}