2024-01-02 03:36:06 +00:00
|
|
|
#include "recomp_ui.h"
|
|
|
|
#include "../../ultramodern/ultramodern.hpp"
|
|
|
|
#include "RmlUi/Core.h"
|
|
|
|
|
|
|
|
class LauncherMenu : public recomp::MenuController {
|
|
|
|
public:
|
|
|
|
LauncherMenu() {
|
|
|
|
|
|
|
|
}
|
|
|
|
~LauncherMenu() override {
|
|
|
|
|
|
|
|
}
|
|
|
|
Rml::ElementDocument* load_document(Rml::Context* context) override {
|
|
|
|
return context->LoadDocument("assets/launcher.rml");
|
|
|
|
}
|
|
|
|
void register_events(recomp::UiEventListenerInstancer& listener) override {
|
|
|
|
recomp::register_event(listener, "start_game",
|
2024-01-07 07:03:12 +00:00
|
|
|
[](const std::string& param, Rml::Event& event) {
|
2024-01-02 03:36:06 +00:00
|
|
|
ultramodern::start_game(0);
|
2024-01-08 06:28:50 +00:00
|
|
|
recomp::set_current_menu(recomp::Menu::None);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
recomp::register_event(listener, "open_controls",
|
|
|
|
[](const std::string& param, Rml::Event& event) {
|
|
|
|
recomp::set_current_menu(recomp::Menu::Config);
|
|
|
|
recomp::set_config_submenu(recomp::ConfigSubmenu::Controls);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
recomp::register_event(listener, "open_settings",
|
|
|
|
[](const std::string& param, Rml::Event& event) {
|
2024-01-02 03:36:06 +00:00
|
|
|
recomp::set_current_menu(recomp::Menu::Config);
|
|
|
|
}
|
|
|
|
);
|
2024-01-08 04:46:44 +00:00
|
|
|
recomp::register_event(listener, "exit_game",
|
|
|
|
[](const std::string& param, Rml::Event& event) {
|
|
|
|
ultramodern::quit();
|
|
|
|
}
|
|
|
|
);
|
2024-01-02 03:36:06 +00:00
|
|
|
}
|
|
|
|
void make_bindings(Rml::Context* context) override {
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
std::unique_ptr<recomp::MenuController> recomp::create_launcher_menu() {
|
|
|
|
return std::make_unique<LauncherMenu>();
|
|
|
|
}
|