2024-01-02 04:36:06 +01: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 08:03:12 +01:00
|
|
|
[](const std::string& param, Rml::Event& event) {
|
2024-01-02 04:36:06 +01:00
|
|
|
ultramodern::start_game(0);
|
2024-01-08 07:28:50 +01: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 04:36:06 +01:00
|
|
|
recomp::set_current_menu(recomp::Menu::Config);
|
|
|
|
}
|
|
|
|
);
|
2024-01-08 05:46:44 +01:00
|
|
|
recomp::register_event(listener, "exit_game",
|
|
|
|
[](const std::string& param, Rml::Event& event) {
|
|
|
|
ultramodern::quit();
|
|
|
|
}
|
|
|
|
);
|
2024-01-02 04:36:06 +01:00
|
|
|
}
|
|
|
|
void make_bindings(Rml::Context* context) override {
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
std::unique_ptr<recomp::MenuController> recomp::create_launcher_menu() {
|
|
|
|
return std::make_unique<LauncherMenu>();
|
|
|
|
}
|