From dc70bd27f217413bbda33b4092a3a52a6f1905d5 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 18 Mar 2025 19:13:16 +0100 Subject: Add controller button icons in hotkeys, separate keyboard hotkeys and controller hotkeys --- src/Theme.cpp | 15 +++++++++++++++ src/gui/GlobalSettingsPage.cpp | 39 ++++++++++++++++++++++++++++++--------- src/gui/Image.cpp | 39 +++++++++++++++++++++++++++++++++++++++ src/gui/Utils.cpp | 7 +++++++ 4 files changed, 91 insertions(+), 9 deletions(-) create mode 100644 src/gui/Image.cpp (limited to 'src') diff --git a/src/Theme.cpp b/src/Theme.cpp index e28ff51..fd40c9b 100644 --- a/src/Theme.cpp +++ b/src/Theme.cpp @@ -111,6 +111,21 @@ namespace gsr { if(!theme->screenshot_texture.load_from_file((resources_path + "images/screenshot.png").c_str())) goto error; + if(!theme->ps4_home_texture.load_from_file((resources_path + "images/ps4_home.png").c_str(), mgl::Texture::LoadOptions{false, false, true})) + goto error; + + if(!theme->ps4_dpad_up_texture.load_from_file((resources_path + "images/ps4_dpad_up.png").c_str(), mgl::Texture::LoadOptions{false, false, true})) + goto error; + + if(!theme->ps4_dpad_down_texture.load_from_file((resources_path + "images/ps4_dpad_down.png").c_str(), mgl::Texture::LoadOptions{false, false, true})) + goto error; + + if(!theme->ps4_dpad_left_texture.load_from_file((resources_path + "images/ps4_dpad_left.png").c_str(), mgl::Texture::LoadOptions{false, false, true})) + goto error; + + if(!theme->ps4_dpad_right_texture.load_from_file((resources_path + "images/ps4_dpad_right.png").c_str(), mgl::Texture::LoadOptions{false, false, true})) + goto error; + return true; error: diff --git a/src/gui/GlobalSettingsPage.cpp b/src/gui/GlobalSettingsPage.cpp index 44c5a1c..3574d57 100644 --- a/src/gui/GlobalSettingsPage.cpp +++ b/src/gui/GlobalSettingsPage.cpp @@ -10,6 +10,7 @@ #include "../../include/gui/Subsection.hpp" #include "../../include/gui/List.hpp" #include "../../include/gui/Label.hpp" +#include "../../include/gui/Image.hpp" #include "../../include/gui/RadioButton.hpp" #include "../../include/gui/LineSeparator.hpp" #include "../../include/gui/CustomRendererWidget.hpp" @@ -325,29 +326,48 @@ namespace gsr { return list; } - std::unique_ptr GlobalSettingsPage::create_hotkey_subsection(ScrollablePage *parent_page) { + static std::unique_ptr create_joystick_hotkey_text(mgl::Texture *image1, mgl::Texture *image2, float max_height, const char *suffix) { + auto list = std::make_unique(List::Orientation::HORIZONTAL, List::Alignment::CENTER); + list->add_widget(std::make_unique