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

Modify a few menus

This commit is contained in:
NyakoFox 2024-04-09 12:56:38 -03:00
parent 5febfaed56
commit 2901810269
6 changed files with 272 additions and 135 deletions

View file

@ -2652,7 +2652,14 @@ void editorclass::tool_place()
static void creategameoptions(void)
{
game.createmenu(Menu::options);
if (key.using_touch)
{
game.createmenu(Menu::gameplayoptions);
}
else
{
game.createmenu(Menu::options);
}
}
static void nextbgcolor(void)

View file

@ -6565,6 +6565,8 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
int maxspacing = 30; // maximum value for menuspacing, can only become lower.
bool auto_buttons = true;
bool auto_center = true;
int button_height = 26;
int button_spacing = 6;
menucountdown = 0;
menuoptions.clear();
touch::remove_dynamic_buttons();
@ -6756,11 +6758,14 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
menuyoff = -20;
break;
case Menu::gameplayoptions:
{
#if !defined(MAKEANDPLAY)
int offset = 0;
if (ingame_titlemode && unlock[Unlock_FLIPMODE])
#endif
{
option(loc::gettext("flip mode"));
option(loc::gettext("flip mode"));
offset++;
}
option(loc::gettext("toggle fps"));
option(loc::gettext("speedrun options"));
@ -6770,18 +6775,29 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
option(loc::gettext("return"));
menuyoff = -10;
maxspacing = 15;
auto_buttons = false;
buttonscentered = true;
touch::create_toggle_button((320 - 160) / 2, 120 - 32, 160, 12, loc::gettext("limit to 30 fps"), offset, !over30mode);
touch::create_toggle_button((320 - 160) / 2, 120 - 32 + 16, 160, 12, loc::gettext("translucent room name bg"), offset, graphics.translucentroomname);
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 + 5);
touch::create_menu_button(198 + 16, 200, 76, 26, loc::gettext("next"), -1);
break;
}
case Menu::graphicoptions:
{
int optionid = 4;
if (!gameScreen.isForcedFullscreen())
{
option(loc::gettext("toggle fullscreen"));
optionid++;
}
option(loc::gettext("scaling mode"));
if (!gameScreen.isForcedFullscreen())
{
option(loc::gettext("resize to nearest"), gameScreen.isWindowed);
optionid++;
}
option(loc::gettext("toggle filter"));
option(loc::gettext("toggle analogue"));
@ -6789,9 +6805,18 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
option(loc::gettext("return"));
menuyoff = -10;
maxspacing = 15;
auto_buttons = false;
buttonscentered = true;
touch::create_menu_button((320 - 160) / 2, 120 - 32, 160, button_height, loc::gettext("scaling mode"), 1);
touch::create_toggle_button((320 - 160) / 2, 120 + 16, 160, 12, loc::gettext("filtered screen"), 3, gameScreen.isFiltered);
touch::create_toggle_button((320 - 160) / 2, 120 + 32, 160, 12, loc::gettext("analogue mode"), 4, gameScreen.badSignalEffect);
touch::create_toggle_button((320 - 160) / 2, 120 + 48, 160, 12, loc::gettext("vsync"), 5, gameScreen.vsync);
touch::create_menu_button(46 - 16, 200, 76, 26, loc::gettext("previous"), -2);
touch::create_menu_button(122, 200, 76, 26, loc::gettext("return"), optionid);
touch::create_menu_button(198 + 16, 200, 76, 26, loc::gettext("next"), -1);
break;
}
case Menu::ed_settings:
option(loc::gettext("change description"));
option(loc::gettext("edit scripts"));
@ -7440,7 +7465,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
}
}
base_y = (240 - count * 32) / 2;
base_y = (240 - count * (button_height + button_spacing)) / 2;
}
int offset = 0;
@ -7450,9 +7475,9 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
{
touch::create_menu_button(
(320 - 160) / 2,
base_y + offset * 32,
base_y + offset * (button_height + button_spacing),
160,
26,
button_height,
menuoptions[i].text,
i,
menuoptions[i].active
@ -7461,6 +7486,8 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
}
}
}
touch::on_menu_create();
}
bool Game::can_unlock_ndm(void)

View file

@ -454,7 +454,14 @@ void menuactionpress(void)
case 2:
//Options
music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::options);
if (key.using_touch)
{
game.createmenu(Menu::gameplayoptions);
}
else
{
game.createmenu(Menu::options);
}
map.nexttowercolour();
break;
case 3:
@ -708,6 +715,22 @@ void menuactionpress(void)
gameScreen.toggleVSync();
game.savestatsandsettings_menu();
}
if (game.currentmenuoption == -2)
{
// gameplay menu
music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::gameplayoptions, true);
map.nexttowercolour();
processed = true;
}
if (game.currentmenuoption == -1)
{
// audio menu
music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::audiooptions, true);
map.nexttowercolour();
processed = true;
}
if (!processed)
{
//back
@ -1026,6 +1049,21 @@ void menuactionpress(void)
map.nexttowercolour();
}
if (game.currentmenuoption == -2)
{
// language menu
music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::language, true);
map.nexttowercolour();
}
if (game.currentmenuoption == -1)
{
// graphics menu
music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::graphicoptions, true);
map.nexttowercolour();
}
break;
}
case Menu::options:
@ -3363,7 +3401,14 @@ static void mapmenuactionpress(const bool version2_2)
// Set this before we create the menu
game.kludge_ingametemp = game.currentmenuname;
game.createmenu(Menu::options);
if (key.using_touch)
{
game.createmenu(Menu::gameplayoptions);
}
else
{
game.createmenu(Menu::options);
}
map.nexttowercolour();
break;
case 32:

View file

@ -303,64 +303,72 @@ static void menurender(void)
break;
case Menu::gameplayoptions:
{
int gameplayoptionsoffset = 0;
#if !defined(MAKEANDPLAY)
if (game.ingame_titlemode && game.unlock[Unlock_FLIPMODE])
#endif
if (key.using_touch)
{
gameplayoptionsoffset = 1;
if (game.currentmenuoption == 0) {
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Flip Mode"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Flip the entire game vertically."), tr, tg, tb);
if (graphics.setflipmode)
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Gameplay Options"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Adjust various gameplay settings."), tr, tg, tb);
}
else
{
int gameplayoptionsoffset = 0;
#if !defined(MAKEANDPLAY)
if (game.ingame_titlemode && game.unlock[Unlock_FLIPMODE])
#endif
{
gameplayoptionsoffset = 1;
if (game.currentmenuoption == 0) {
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Flip Mode"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Flip the entire game vertically."), tr, tg, tb);
if (graphics.setflipmode)
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Currently ENABLED!"), tr, tg, tb);
}
else
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Currently Disabled."), tr / 2, tg / 2, tb / 2);
}
}
}
if (game.currentmenuoption == gameplayoptionsoffset + 0)
{
//Toggle FPS
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Toggle 30+ FPS"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Change whether the game runs at 30 or over 30 FPS."), tr, tg, tb);
if (!game.over30mode)
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Currently ENABLED!"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: 30 FPS"), tr / 2, tg / 2, tb / 2);
}
else
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Currently Disabled."), tr/2, tg/2, tb/2);
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: Over 30 FPS"), tr, tg, tb);
}
break;
}
}
if (game.currentmenuoption == gameplayoptionsoffset + 0)
{
//Toggle FPS
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Toggle 30+ FPS"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Change whether the game runs at 30 or over 30 FPS."), tr, tg, tb);
if (!game.over30mode)
else if (game.currentmenuoption == gameplayoptionsoffset + 1)
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: 30 FPS"), tr/2, tg/2, tb/2);
//Speedrunner options
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Speedrunner Options"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Access some advanced settings that might be of interest to speedrunners."), tr, tg, tb);
}
else
else if (game.currentmenuoption == gameplayoptionsoffset + 2)
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: Over 30 FPS"), tr, tg, tb);
//Advanced options
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Advanced Options"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, 65, loc::gettext("All other gameplay settings."), tr, tg, tb);
}
else if (game.currentmenuoption == gameplayoptionsoffset + 3)
{
//Clear Data
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Clear Data"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Delete your main game save data and unlocked play modes."), tr, tg, tb);
}
else if (game.currentmenuoption == gameplayoptionsoffset + 4)
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Clear Data"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Delete your custom level save data and completion stars."), tr, tg, tb);
}
break;
}
else if (game.currentmenuoption == gameplayoptionsoffset + 1)
{
//Speedrunner options
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Speedrunner Options"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Access some advanced settings that might be of interest to speedrunners."), tr, tg, tb);
}
else if (game.currentmenuoption == gameplayoptionsoffset + 2)
{
//Advanced options
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Advanced Options"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, 65, loc::gettext("All other gameplay settings."), tr, tg, tb);
}
else if (game.currentmenuoption == gameplayoptionsoffset + 3)
{
//Clear Data
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Clear Data"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Delete your main game save data and unlocked play modes."), tr, tg, tb);
}
else if (game.currentmenuoption == gameplayoptionsoffset + 4)
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Clear Data"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Delete your custom level save data and completion stars."), tr, tg, tb);
}
break;
@ -406,91 +414,99 @@ static void menurender(void)
break;
case Menu::graphicoptions:
{
int offset = 0;
if (game.currentmenuoption == offset + 0 && !gameScreen.isForcedFullscreen())
if (key.using_touch)
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Toggle Fullscreen"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Change to fullscreen/windowed mode."), tr, tg, tb);
if (gameScreen.isWindowed)
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: WINDOWED"), tr, tg, tb);
}
else
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: FULLSCREEN"), tr, tg, tb);
}
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Graphics Options"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Adjust screen settings."), tr, tg, tb);
}
if (gameScreen.isForcedFullscreen())
else
{
--offset;
}
if (game.currentmenuoption == offset + 1)
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Scaling Mode"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Choose letterbox/stretch/integer mode."), tr, tg, tb);
switch (gameScreen.scalingMode)
int offset = 0;
if (game.currentmenuoption == offset + 0 && !gameScreen.isForcedFullscreen())
{
case SCALING_INTEGER:
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: INTEGER"), tr, tg, tb);
break;
case SCALING_STRETCH:
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: STRETCH"), tr, tg, tb);
break;
case SCALING_LETTERBOX:
default:
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: LETTERBOX"), tr, tg, tb);
break;
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Toggle Fullscreen"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Change to fullscreen/windowed mode."), tr, tg, tb);
if (gameScreen.isWindowed)
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: WINDOWED"), tr, tg, tb);
}
else
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: FULLSCREEN"), tr, tg, tb);
}
}
}
if (game.currentmenuoption == offset + 2 && !gameScreen.isForcedFullscreen())
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Resize to Nearest"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Resize to the nearest window size that is of an integer multiple."), tr, tg, tb);
if (!gameScreen.isWindowed)
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("You must be in windowed mode to use this option."), tr, tg, tb);
}
}
if (gameScreen.isForcedFullscreen())
{
--offset;
}
if (game.currentmenuoption == offset + 3)
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Toggle Filter"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Change to nearest/linear filter."), tr, tg, tb);
if (gameScreen.isFiltered)
if (gameScreen.isForcedFullscreen())
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: LINEAR"), tr, tg, tb);
--offset;
}
else
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: NEAREST"), tr, tg, tb);
}
}
if (game.currentmenuoption == offset + 4)
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Analogue Mode"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, 65, loc::gettext("There is nothing wrong with your television set. Do not attempt to adjust the picture."), tr, tg, tb);
}
if (game.currentmenuoption == offset + 5)
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Toggle VSync"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Turn VSync on or off."), tr, tg, tb);
if (game.currentmenuoption == offset + 1)
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Scaling Mode"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Choose letterbox/stretch/integer mode."), tr, tg, tb);
if (!gameScreen.vsync)
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: VSYNC OFF"), tr/2, tg/2, tb/2);
switch (gameScreen.scalingMode)
{
case SCALING_INTEGER:
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: INTEGER"), tr, tg, tb);
break;
case SCALING_STRETCH:
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: STRETCH"), tr, tg, tb);
break;
case SCALING_LETTERBOX:
default:
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: LETTERBOX"), tr, tg, tb);
break;
}
}
else
if (game.currentmenuoption == offset + 2 && !gameScreen.isForcedFullscreen())
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: VSYNC ON"), tr, tg, tb);
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Resize to Nearest"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Resize to the nearest window size that is of an integer multiple."), tr, tg, tb);
if (!gameScreen.isWindowed)
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("You must be in windowed mode to use this option."), tr, tg, tb);
}
}
if (gameScreen.isForcedFullscreen())
{
--offset;
}
if (game.currentmenuoption == offset + 3)
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Toggle Filter"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Change to nearest/linear filter."), tr, tg, tb);
if (gameScreen.isFiltered)
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: LINEAR"), tr, tg, tb);
}
else
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: NEAREST"), tr, tg, tb);
}
}
if (game.currentmenuoption == offset + 4)
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Analogue Mode"), tr, tg, tb);
font::print_wrap(PR_CEN, -1, 65, loc::gettext("There is nothing wrong with your television set. Do not attempt to adjust the picture."), tr, tg, tb);
}
if (game.currentmenuoption == offset + 5)
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Toggle VSync"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Turn VSync on or off."), tr, tg, tb);
if (!gameScreen.vsync)
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: VSYNC OFF"), tr / 2, tg / 2, tb / 2);
}
else
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Current mode: VSYNC ON"), tr, tg, tb);
}
}
}
break;

View file

@ -33,6 +33,7 @@ namespace touch
bool use_buttons;
int scale;
bool textbox_style;
bool scroll;
void refresh_all_buttons(void)
{
@ -52,7 +53,7 @@ namespace touch
int get_rect(TouchButton* button, SDL_Rect* rect)
{
rect->x = button->x;
rect->y = button->y;
rect->y = button->y - scroll;
rect->w = button->width;
rect->h = button->height;
@ -124,6 +125,7 @@ namespace touch
button.type = TOUCH_BUTTON_TYPE_NONE;
button.id = -1;
button.disabled = false;
button.checked = false;
return button;
}
@ -148,6 +150,16 @@ namespace touch
register_button(button);
}
void create_toggle_button(int x, int y, int width, int height, std::string text, int id, bool checked)
{
TouchButton button = create_button(x, y, width, height, text);
button.type = TOUCH_BUTTON_TYPE_MENU_TOGGLE;
button.id = id;
button.checked = checked;
register_button(button);
}
void register_button(TouchButton button)
{
dynamic_buttons.push_back(button);
@ -166,6 +178,9 @@ namespace touch
bool version2_2 = GlitchrunnerMode_less_than_or_equal(Glitchrunner2_2);
switch (button->type)
{
case TOUCH_BUTTON_TYPE_MENU_TOGGLE:
button->checked = !button->checked;
SDL_FALLTHROUGH;
case TOUCH_BUTTON_TYPE_MENU:
game.currentmenuoption = button->id;
menuactionpress();
@ -303,13 +318,30 @@ namespace touch
inner_div = 6;
}
graphics.fill_rect(button->x + 4 * scale, button->y + 4 * scale, button->width, button->height, r / shadow_div, g / shadow_div, b / shadow_div);
int offset = (button->down) ? 1 : 0;
graphics.fill_rect(button->x + offset * scale, button->y + offset * scale, button->width, button->height, use_r, use_g, use_b);
graphics.fill_rect(button->x + (offset + 2) * scale, button->y + (2 + offset) * scale, button->width - 4 * scale, button->height - 4 * scale, use_r / inner_div, use_g / inner_div, use_b / inner_div);
font::print(PR_CEN | (SDL_min((scale - 1), 7) << 0), button->x + (button->width / 2) + offset * scale, button->y + (button->height / 2) + (offset - 4) * scale, button->text, 196, 196, 255 - help.glow);
int font_scale = (SDL_min((scale - 1), 7) << 0);
int height = font::height(PR_CJK_LOW | font_scale);
switch (button->type)
{
case TOUCH_BUTTON_TYPE_MENU_TOGGLE:
graphics.draw_rect(button->x + offset * scale, button->y + offset * scale, 10, 10, use_r, use_g, use_b);
if (button->checked)
{
graphics.fill_rect(button->x + 2 * scale + offset * scale, button->y + 2 * scale + offset * scale, 6, 6, use_r, use_g, use_b);
}
font::print(PR_CJK_LOW | font_scale, button->x + 16 + offset * scale, button->y + ((button->height - height) / 2 + offset) * scale, button->text, use_r, use_g, use_b);
break;
default:
graphics.fill_rect(button->x + 4 * scale, button->y + 4 * scale, button->width, button->height, r / shadow_div, g / shadow_div, b / shadow_div);
graphics.fill_rect(button->x + offset * scale, button->y + offset * scale, button->width, button->height, use_r, use_g, use_b);
graphics.fill_rect(button->x + (offset + 2) * scale, button->y + (2 + offset) * scale, button->width - 4 * scale, button->height - 4 * scale, use_r / inner_div, use_g / inner_div, use_b / inner_div);
font::print(PR_CEN | PR_CJK_LOW | font_scale, button->x + (button->width / 2) + offset * scale, button->y + ((button->height - height) / 2 + offset) * scale, button->text, 196, 196, 255 - help.glow);
break;
}
}
}
}
@ -365,6 +397,11 @@ namespace touch
}
}
void on_menu_create(void)
{
scroll = 0;
}
void update_buttons(void)
{
if (!use_buttons || graphics.fademode != FADE_NONE)

View file

@ -56,6 +56,7 @@ enum TouchButtonType
{
TOUCH_BUTTON_TYPE_NONE,
TOUCH_BUTTON_TYPE_MENU,
TOUCH_BUTTON_TYPE_MENU_TOGGLE,
TOUCH_BUTTON_TYPE_MAP
};
@ -72,6 +73,7 @@ struct TouchButton
bool ui; // Whether the button is on the UI layer or not
int id; // The ID for the button, mainly used for menu buttons
bool disabled; // Whether the button is disabled or not (gray and can't use), different from active
bool checked; // If this is a checkbox, whether it's checked or not
std::string text; // The text for the button, if it doesn't have an image
SDL_Texture* image; // The image that gets displayed on the button, can be NULL
SDL_FingerID fingerId;
@ -85,9 +87,11 @@ namespace touch
extern std::vector<TouchButton> dynamic_buttons;
extern std::vector<TouchButton*> all_buttons;
extern int scale;
extern bool scroll;
void refresh_buttons(void);
void reset(void);
void on_menu_create(void);
void update_buttons(void);
TouchButton create_button(int x, int y, int width, int height, std::string text);
@ -95,6 +99,7 @@ namespace touch
void create_menu_button(int x, int y, int width, int height, std::string text, int id);
void create_menu_button(int x, int y, int width, int height, std::string text, int id, bool disabled);
void create_toggle_button(int x, int y, int width, int height, std::string text, int id, bool checked);
void remove_dynamic_buttons(void);