diff options
Diffstat (limited to 'include/gui')
-rw-r--r-- | include/gui/Button.hpp | 7 | ||||
-rw-r--r-- | include/gui/GlobalSettingsPage.hpp | 34 | ||||
-rw-r--r-- | include/gui/SettingsPage.hpp | 2 | ||||
-rw-r--r-- | include/gui/Utils.hpp | 1 |
4 files changed, 42 insertions, 2 deletions
diff --git a/include/gui/Button.hpp b/include/gui/Button.hpp index bc1dd94..eb68e99 100644 --- a/include/gui/Button.hpp +++ b/include/gui/Button.hpp @@ -5,6 +5,7 @@ #include <mglpp/graphics/Color.hpp> #include <mglpp/graphics/Text.hpp> +#include <mglpp/graphics/Sprite.hpp> namespace gsr { class Button : public Widget { @@ -20,15 +21,21 @@ namespace gsr { mgl::vec2f get_size() override; void set_border_scale(float scale); + void set_bg_hover_color(mgl::Color color); + void set_icon(mgl::Texture *texture); const std::string& get_text() const; void set_text(std::string str); std::function<void()> on_click; private: + void scale_sprite_to_button_size(); + private: mgl::vec2f size; mgl::Color bg_color; + mgl::Color bg_hover_color; mgl::Text text; + mgl::Sprite sprite; float border_scale = 0.0015f; }; }
\ No newline at end of file diff --git a/include/gui/GlobalSettingsPage.hpp b/include/gui/GlobalSettingsPage.hpp new file mode 100644 index 0000000..cd4a50c --- /dev/null +++ b/include/gui/GlobalSettingsPage.hpp @@ -0,0 +1,34 @@ +#pragma once + +#include "StaticPage.hpp" +#include "../GsrInfo.hpp" +#include "../Config.hpp" + +namespace gsr { + class GsrPage; + class PageStack; + class ScrollablePage; + class Subsection; + class RadioButton; + + class GlobalSettingsPage : public StaticPage { + public: + GlobalSettingsPage(const GsrInfo *gsr_info, Config &config, PageStack *page_stack); + GlobalSettingsPage(const GlobalSettingsPage&) = delete; + GlobalSettingsPage& operator=(const GlobalSettingsPage&) = delete; + + void load(); + void save(); + void on_navigate_away_from_page() override; + private: + std::unique_ptr<Subsection> create_appearance_subsection(ScrollablePage *parent_page); + void add_widgets(); + private: + Config &config; + const GsrInfo *gsr_info = nullptr; + + GsrPage *content_page_ptr = nullptr; + PageStack *page_stack = nullptr; + RadioButton *tint_color_radio_button_ptr = nullptr; + }; +}
\ No newline at end of file diff --git a/include/gui/SettingsPage.hpp b/include/gui/SettingsPage.hpp index b115d78..981c99a 100644 --- a/include/gui/SettingsPage.hpp +++ b/include/gui/SettingsPage.hpp @@ -181,7 +181,5 @@ namespace gsr { RadioButton *turn_on_replay_automatically_mode_ptr = nullptr; PageStack *page_stack = nullptr; - - mgl::Text settings_title_text; }; }
\ No newline at end of file diff --git a/include/gui/Utils.hpp b/include/gui/Utils.hpp index 6963bc5..35b2bb7 100644 --- a/include/gui/Utils.hpp +++ b/include/gui/Utils.hpp @@ -15,4 +15,5 @@ namespace gsr { void draw_rectangle_outline(mgl::Window &window, mgl::vec2f pos, mgl::vec2f size, mgl::Color color, float border_size); double get_frame_delta_seconds(); void set_frame_delta_seconds(double frame_delta); + mgl::vec2f scale_keep_aspect_ratio(mgl::vec2f from, mgl::vec2f to); }
\ No newline at end of file |