mirror of
https://github.com/Mr-Wiseguy/Zelda64Recomp.git
synced 2024-11-25 14:16:58 +01:00
Hooked up controls and settings buttons in launcher
This commit is contained in:
parent
15ce3b194d
commit
0fcc366a35
@ -31,7 +31,7 @@
|
||||
<!-- <handle move_target="#document"> -->
|
||||
<div id="window" style="display:flex; flex-flow: column; background-color:rgba(0,0,0,0)">
|
||||
<div class="centered-page">
|
||||
<tabset class="centered-page__modal tabs">
|
||||
<tabset class="centered-page__modal tabs" id="config_tabset">
|
||||
<tab class="tab" id="tab_graphics" autofocus>
|
||||
<div>Graphics</div>
|
||||
<div class="tab__indicator"></div>
|
||||
|
@ -36,11 +36,11 @@
|
||||
<div class="menu-list-item__bullet">•</div>
|
||||
<div class="menu-list-item__label">Start game</div>
|
||||
</button>
|
||||
<button class="menu-list-item menu-list-item--right">
|
||||
<button onclick="open_controls" class="menu-list-item menu-list-item--right">
|
||||
<div class="menu-list-item__bullet">•</div>
|
||||
<div class="menu-list-item__label">Setup controls</div>
|
||||
</button>
|
||||
<button class="menu-list-item menu-list-item--right">
|
||||
<button onclick="open_settings" class="menu-list-item menu-list-item--right">
|
||||
<div class="menu-list-item__bullet">•</div>
|
||||
<div class="menu-list-item__label">Settings</div>
|
||||
</button>
|
||||
|
@ -42,6 +42,16 @@ namespace recomp {
|
||||
};
|
||||
|
||||
void set_current_menu(Menu menu);
|
||||
|
||||
enum class ConfigSubmenu {
|
||||
Graphics,
|
||||
Controls,
|
||||
Audio,
|
||||
Count
|
||||
};
|
||||
|
||||
void set_config_submenu(ConfigSubmenu submenu);
|
||||
|
||||
void destroy_ui();
|
||||
void apply_color_hack();
|
||||
}
|
||||
|
@ -17,6 +17,17 @@ public:
|
||||
recomp::register_event(listener, "start_game",
|
||||
[](const std::string& param, Rml::Event& event) {
|
||||
ultramodern::start_game(0);
|
||||
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) {
|
||||
recomp::set_current_menu(recomp::Menu::Config);
|
||||
}
|
||||
);
|
||||
|
@ -665,6 +665,18 @@ struct {
|
||||
}
|
||||
}
|
||||
|
||||
void swap_config_menu(recomp::ConfigSubmenu submenu) {
|
||||
if (current_document != nullptr) {
|
||||
Rml::Element* config_tabset_base = current_document->GetElementById("config_tabset");
|
||||
if (config_tabset_base != nullptr) {
|
||||
Rml::ElementTabSet* config_tabset = rmlui_dynamic_cast<Rml::ElementTabSet*>(config_tabset_base);
|
||||
if (config_tabset != nullptr) {
|
||||
config_tabset->SetActiveTab(static_cast<int>(submenu));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void load_documents() {
|
||||
if (!documents.empty()) {
|
||||
Rml::Factory::RegisterEventListenerInstancer(nullptr);
|
||||
@ -703,6 +715,9 @@ struct {
|
||||
}
|
||||
|
||||
void update_focus(bool mouse_moved) {
|
||||
if (current_document == nullptr) {
|
||||
return;
|
||||
}
|
||||
Rml::Element* focused = current_document->GetFocusLeafNode();
|
||||
|
||||
// If there was mouse motion, get the current hovered element (or its target if it points to one) and focus that if applicable.
|
||||
@ -817,6 +832,7 @@ bool recomp::try_deque_event(SDL_Event& out) {
|
||||
}
|
||||
|
||||
std::atomic<recomp::Menu> open_menu = recomp::Menu::Launcher;
|
||||
std::atomic<recomp::ConfigSubmenu> open_config_submenu = recomp::ConfigSubmenu::Count;
|
||||
|
||||
void draw_hook(RT64::RenderCommandList* command_list, RT64::RenderTexture* swap_chain_texture) {
|
||||
int num_keys;
|
||||
@ -839,6 +855,12 @@ void draw_hook(RT64::RenderCommandList* command_list, RT64::RenderTexture* swap_
|
||||
UIContext.rml.swap_document(cur_menu);
|
||||
}
|
||||
|
||||
recomp::ConfigSubmenu config_submenu = open_config_submenu.load();
|
||||
if (config_submenu != recomp::ConfigSubmenu::Count) {
|
||||
UIContext.rml.swap_config_menu(config_submenu);
|
||||
open_config_submenu.store(recomp::ConfigSubmenu::Count);
|
||||
}
|
||||
|
||||
prev_menu = cur_menu;
|
||||
|
||||
SDL_Event cur_event{};
|
||||
@ -896,6 +918,10 @@ void recomp::set_current_menu(Menu menu) {
|
||||
open_menu.store(menu);
|
||||
}
|
||||
|
||||
void recomp::set_config_submenu(recomp::ConfigSubmenu submenu) {
|
||||
open_config_submenu.store(submenu);
|
||||
}
|
||||
|
||||
void recomp::destroy_ui() {
|
||||
Rml::Shutdown();
|
||||
UIContext.rml.unload();
|
||||
|
Loading…
Reference in New Issue
Block a user