summaryrefslogtreecommitdiff
path: root/Games
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-11-10 14:31:14 +0100
committerAndreas Kling <kling@serenityos.org>2020-11-10 14:32:45 +0100
commit626c17d284a228fad7f57ada4370acaee7f6c2ed (patch)
treefb5ae4ded5b6314a3d26878eacf98246e852a95c /Games
parent51e7c6e348e2025994e3d93ea66da04a09b39e63 (diff)
downloadserenity-626c17d284a228fad7f57ada4370acaee7f6c2ed.zip
Breakout: Add simple menu and about dialog :^)
Diffstat (limited to 'Games')
-rw-r--r--Games/Breakout/main.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/Games/Breakout/main.cpp b/Games/Breakout/main.cpp
index a72ee7b05c..3bc25837aa 100644
--- a/Games/Breakout/main.cpp
+++ b/Games/Breakout/main.cpp
@@ -25,8 +25,11 @@
*/
#include "Game.h"
+#include <LibGUI/AboutDialog.h>
#include <LibGUI/Application.h>
#include <LibGUI/Icon.h>
+#include <LibGUI/Menu.h>
+#include <LibGUI/MenuBar.h>
#include <LibGUI/Window.h>
#include <LibGfx/Bitmap.h>
@@ -41,5 +44,21 @@ int main(int argc, char** argv)
window->set_double_buffering_enabled(false);
window->set_main_widget<Breakout::Game>();
window->show();
+
+ auto menubar = GUI::MenuBar::construct();
+
+ auto& app_menu = menubar->add_menu("Breakout");
+ app_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) {
+ GUI::Application::the()->quit();
+ return;
+ }));
+
+ auto& help_menu = menubar->add_menu("Help");
+ help_menu.add_action(GUI::Action::create("About", [&](const GUI::Action&) {
+ GUI::AboutDialog::show("Breakout", app_icon.bitmap_for_size(32), window);
+ }));
+
+ app->set_menubar(move(menubar));
+
return app->exec();
}