From 189736c1a96a1ad0e571ad69f01039e96455011a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 22 Feb 2025 13:31:51 +0100 Subject: Add option to take a screenshot (default hotkey: alt+f1) --- include/gui/Button.hpp | 1 + include/gui/DropdownButton.hpp | 1 + include/gui/GlobalSettingsPage.hpp | 4 ++ include/gui/GsrPage.hpp | 5 ++- include/gui/ScreenshotSettingsPage.hpp | 78 ++++++++++++++++++++++++++++++++++ include/gui/SettingsPage.hpp | 2 +- 6 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 include/gui/ScreenshotSettingsPage.hpp (limited to 'include/gui') diff --git a/include/gui/Button.hpp b/include/gui/Button.hpp index eb68e99..7070457 100644 --- a/include/gui/Button.hpp +++ b/include/gui/Button.hpp @@ -30,6 +30,7 @@ namespace gsr { std::function on_click; private: void scale_sprite_to_button_size(); + float get_button_height(); private: mgl::vec2f size; mgl::Color bg_color; diff --git a/include/gui/DropdownButton.hpp b/include/gui/DropdownButton.hpp index cbbcda2..486e811 100644 --- a/include/gui/DropdownButton.hpp +++ b/include/gui/DropdownButton.hpp @@ -20,6 +20,7 @@ namespace gsr { void add_item(const std::string &text, const std::string &id, const std::string &description = ""); void set_item_label(const std::string &id, const std::string &new_label); void set_item_icon(const std::string &id, mgl::Texture *texture); + void set_item_description(const std::string &id, const std::string &new_description); void set_description(std::string description_text); void set_activated(bool activated); diff --git a/include/gui/GlobalSettingsPage.hpp b/include/gui/GlobalSettingsPage.hpp index 580e943..d0a0336 100644 --- a/include/gui/GlobalSettingsPage.hpp +++ b/include/gui/GlobalSettingsPage.hpp @@ -25,6 +25,7 @@ namespace gsr { RECORD_START_STOP, RECORD_PAUSE_UNPAUSE, STREAM_START_STOP, + TAKE_SCREENSHOT, SHOW_HIDE }; @@ -44,6 +45,7 @@ namespace gsr { std::function on_click_exit_program_button; std::function on_keyboard_hotkey_changed; std::function on_joystick_hotkey_changed; + std::function on_page_closed; private: void load_hotkeys(); @@ -55,6 +57,7 @@ namespace gsr { std::unique_ptr create_replay_hotkey_options(); std::unique_ptr create_record_hotkey_options(); std::unique_ptr create_stream_hotkey_options(); + std::unique_ptr create_screenshot_hotkey_options(); std::unique_ptr create_hotkey_control_buttons(); std::unique_ptr create_hotkey_subsection(ScrollablePage *parent_page); std::unique_ptr