mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 13:43:45 +03:00
Games: Add fullscreen option
This commit is contained in:
parent
13c66ebf12
commit
64edf6913f
Notes:
sideshowbarker
2024-07-17 07:08:37 +09:00
Author: https://github.com/hughdavenport Commit: https://github.com/SerenityOS/serenity/commit/64edf6913f Pull-request: https://github.com/SerenityOS/serenity/pull/22591 Reviewed-by: https://github.com/ADKaster ✅
@ -216,6 +216,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
GUI::Application::the()->quit();
|
||||
}));
|
||||
|
||||
auto view_menu = window->add_menu("&View"_string);
|
||||
view_menu->add_action(GUI::CommonActions::make_fullscreen_action([&](auto&) {
|
||||
window->set_fullscreen(!window->is_fullscreen());
|
||||
}));
|
||||
|
||||
auto help_menu = window->add_menu("&Help"_string);
|
||||
help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
|
||||
help_menu->add_action(GUI::CommonActions::make_help_action([](auto&) {
|
||||
|
@ -73,6 +73,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
GUI::Application::the()->quit();
|
||||
}));
|
||||
|
||||
auto view_menu = window->add_menu("&View"_string);
|
||||
view_menu->add_action(GUI::CommonActions::make_fullscreen_action([&](auto&) {
|
||||
window->set_fullscreen(!window->is_fullscreen());
|
||||
}));
|
||||
|
||||
auto help_menu = window->add_menu("&Help"_string);
|
||||
help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
|
||||
help_menu->add_action(GUI::CommonActions::make_help_action([&man_file](auto&) {
|
||||
|
@ -194,6 +194,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
engine_submenu->add_action(*action);
|
||||
}
|
||||
|
||||
auto view_menu = window->add_menu("&View"_string);
|
||||
view_menu->add_action(GUI::CommonActions::make_fullscreen_action([&](auto&) {
|
||||
window->set_fullscreen(!window->is_fullscreen());
|
||||
}));
|
||||
|
||||
auto help_menu = window->add_menu("&Help"_string);
|
||||
help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
|
||||
help_menu->add_action(GUI::CommonActions::make_help_action([](auto&) {
|
||||
|
@ -60,6 +60,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
GUI::Application::the()->quit();
|
||||
}));
|
||||
|
||||
auto view_menu = window->add_menu("&View"_string);
|
||||
view_menu->add_action(GUI::CommonActions::make_fullscreen_action([&](auto&) {
|
||||
window->set_fullscreen(!window->is_fullscreen());
|
||||
}));
|
||||
|
||||
auto help_menu = window->add_menu("&Help"_string);
|
||||
help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
|
||||
help_menu->add_action(GUI::CommonActions::make_help_action([&man_file](auto&) {
|
||||
|
@ -82,10 +82,14 @@ void Game::paint_event(GUI::PaintEvent& event)
|
||||
|
||||
void Game::keydown_event(GUI::KeyEvent& event)
|
||||
{
|
||||
// FIXME: After #22573 is merged, then remove the case for F11 below and ensure it is in this check here which also checks for modifiers
|
||||
switch (event.key()) {
|
||||
case Key_Escape:
|
||||
GUI::Application::the()->quit();
|
||||
break;
|
||||
case Key_F11:
|
||||
event.ignore();
|
||||
break;
|
||||
default:
|
||||
player_input();
|
||||
break;
|
||||
|
@ -60,6 +60,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
GUI::Application::the()->quit();
|
||||
}));
|
||||
|
||||
auto view_menu = window->add_menu("&View"_string);
|
||||
view_menu->add_action(GUI::CommonActions::make_fullscreen_action([&](auto&) {
|
||||
window->set_fullscreen(!window->is_fullscreen());
|
||||
}));
|
||||
|
||||
auto help_menu = window->add_menu("&Help"_string);
|
||||
help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
|
||||
help_menu->add_action(GUI::CommonActions::make_help_action([](auto&) {
|
||||
|
@ -187,6 +187,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
GUI::Application::the()->quit();
|
||||
}));
|
||||
|
||||
auto view_menu = window->add_menu("&View"_string);
|
||||
view_menu->add_action(GUI::CommonActions::make_fullscreen_action([&](auto&) {
|
||||
window->set_fullscreen(!window->is_fullscreen());
|
||||
}));
|
||||
|
||||
auto help_menu = window->add_menu("&Help"_string);
|
||||
help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
|
||||
help_menu->add_action(GUI::CommonActions::make_help_action([](auto&) {
|
||||
|
@ -150,6 +150,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
GUI::Application::the()->quit();
|
||||
}));
|
||||
|
||||
auto view_menu = window->add_menu("&View"_string);
|
||||
view_menu->add_action(GUI::CommonActions::make_fullscreen_action([&](auto&) {
|
||||
window->set_fullscreen(!window->is_fullscreen());
|
||||
}));
|
||||
|
||||
auto help_menu = window->add_menu("&Help"_string);
|
||||
help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
|
||||
help_menu->add_action(GUI::CommonActions::make_help_action([](auto&) {
|
||||
|
@ -97,6 +97,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
game_menu->add_separator();
|
||||
game_menu->add_action(GUI::CommonActions::make_quit_action([&](auto&) { app->quit(); }));
|
||||
|
||||
auto view_menu = window->add_menu("&View"_string);
|
||||
view_menu->add_action(GUI::CommonActions::make_fullscreen_action([&](auto&) {
|
||||
window->set_fullscreen(!window->is_fullscreen());
|
||||
}));
|
||||
|
||||
auto help_menu = window->add_menu("&Help"_string);
|
||||
help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
|
||||
help_menu->add_action(GUI::CommonActions::make_help_action([](auto&) {
|
||||
|
@ -74,6 +74,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
game_menu->add_action(*chord_toggler_action);
|
||||
game_menu->add_separator();
|
||||
|
||||
// Put Fullscreen in Game rather than View
|
||||
// When in beginner mode it can only show 3 menus. Adding View makes 4
|
||||
game_menu->add_action(GUI::CommonActions::make_fullscreen_action([&](auto&) {
|
||||
window->set_fullscreen(!window->is_fullscreen());
|
||||
}));
|
||||
game_menu->add_separator();
|
||||
|
||||
game_menu->add_action(GUI::CommonActions::make_quit_action([](auto&) {
|
||||
GUI::Application::the()->quit();
|
||||
}));
|
||||
|
@ -151,6 +151,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
GUI::Application::the()->quit();
|
||||
}));
|
||||
|
||||
auto view_menu = window->add_menu("&View"_string);
|
||||
view_menu->add_action(GUI::CommonActions::make_fullscreen_action([&](auto&) {
|
||||
window->set_fullscreen(!window->is_fullscreen());
|
||||
}));
|
||||
|
||||
auto help_menu = window->add_menu("&Help"_string);
|
||||
help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
|
||||
help_menu->add_action(GUI::CommonActions::make_help_action([](auto&) {
|
||||
|
@ -239,6 +239,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
game_menu->add_separator();
|
||||
game_menu->add_action(GUI::CommonActions::make_quit_action([&](auto&) { app->quit(); }));
|
||||
|
||||
auto view_menu = window->add_menu("&View"_string);
|
||||
view_menu->add_action(GUI::CommonActions::make_fullscreen_action([&](auto&) {
|
||||
window->set_fullscreen(!window->is_fullscreen());
|
||||
}));
|
||||
|
||||
auto help_menu = window->add_menu("&Help"_string);
|
||||
help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
|
||||
help_menu->add_action(GUI::CommonActions::make_help_action([&man_file](auto&) {
|
||||
|
@ -284,6 +284,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
view_menu->add_action(high_score_action);
|
||||
view_menu->add_action(best_time_actions);
|
||||
|
||||
view_menu->add_separator();
|
||||
view_menu->add_action(GUI::CommonActions::make_fullscreen_action([&](auto&) {
|
||||
window->set_fullscreen(!window->is_fullscreen());
|
||||
}));
|
||||
|
||||
auto help_menu = window->add_menu("&Help"_string);
|
||||
help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
|
||||
help_menu->add_action(GUI::CommonActions::make_help_action([&man_file](auto&) {
|
||||
|
Loading…
Reference in New Issue
Block a user