Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Touch buttons #1164

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a5795a6
Initial touch input support
AllyTally Jan 29, 2024
9eeb737
Add string to language files
AllyTally Jan 29, 2024
9c83a4b
Ignore Android's back button when disabling touch
NyakoFox Apr 2, 2024
1412c90
Don't close ingame menu when pressing confirm btn
NyakoFox Apr 2, 2024
c5b3664
Replace screen_tapped with screen_down
NyakoFox Apr 11, 2024
a53adde
Replace float scale with int scale
NyakoFox Apr 11, 2024
018cbd9
Initial touch button attempt
NyakoFox Mar 25, 2024
eea8741
Automatic menu buttons
NyakoFox Mar 25, 2024
59a97d2
Modify a few menus
NyakoFox Apr 9, 2024
e96d139
Slider inputs for audio volume
NyakoFox Apr 9, 2024
3bdeaf8
Touch input menu
NyakoFox Apr 9, 2024
21496e3
Accessibility menu
NyakoFox Apr 10, 2024
b47955e
Work on language menu
NyakoFox Apr 10, 2024
8b45529
Finish language menu
NyakoFox Apr 11, 2024
1ba14b0
Summary changes
NyakoFox Apr 11, 2024
eef83a0
Buttonify map screen
NyakoFox Apr 11, 2024
a32bf13
Fix bug with graphics menu
NyakoFox Apr 11, 2024
d54af27
Fix first-time lang screen
NyakoFox Apr 11, 2024
07dfb6e
Fix M&P builds failing
NyakoFox Apr 11, 2024
504208e
Fix a few options
NyakoFox Apr 11, 2024
8c06371
Language menu changes
NyakoFox Apr 11, 2024
42ab55d
Remove save and exit button
NyakoFox Apr 11, 2024
44a40c1
Secret lab buttons, fix preloader buttons
NyakoFox Apr 11, 2024
a396424
Comment out player levels for now
NyakoFox Apr 11, 2024
e0debda
Working back button
NyakoFox Apr 12, 2024
c394a63
Offset back button, fix buttons appearing in ingame menu when returni…
NyakoFox Apr 12, 2024
757e20a
Fix saveless saving and quitting hiding buttons
NyakoFox Jun 4, 2024
9f9c813
Remove buggy switch to touch controls in touch input menu
NyakoFox Jun 4, 2024
30abc8a
Add checkpoint saving option to touch controls
NyakoFox Sep 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Modify a few menus
  • Loading branch information
NyakoFox committed Sep 29, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 59a97d2404ab4e9edc50a5d17fdd8ca020469f24
9 changes: 8 additions & 1 deletion desktop_version/src/Editor.cpp
Original file line number Diff line number Diff line change
@@ -2653,7 +2653,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)
39 changes: 33 additions & 6 deletions desktop_version/src/Game.cpp
Original file line number Diff line number Diff line change
@@ -6608,6 +6608,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();
@@ -6799,11 +6801,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"));
@@ -6813,28 +6818,48 @@ 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"));
option(loc::gettext("toggle vsync"));
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"));
@@ -7484,7 +7509,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;
@@ -7494,9 +7519,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
@@ -7505,6 +7530,8 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
}
}
}

touch::on_menu_create();
}

bool Game::can_unlock_ndm(void)
49 changes: 47 additions & 2 deletions desktop_version/src/Input.cpp
Original file line number Diff line number Diff line change
@@ -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
@@ -1032,6 +1055,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:
@@ -3370,7 +3408,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:
Loading