mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Breakout: Add simple menu and about dialog :^)
This commit is contained in:
parent
51e7c6e348
commit
626c17d284
Notes:
sideshowbarker
2024-07-19 01:28:08 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/626c17d284a
1 changed files with 19 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue