From 7c4af06d953ad439906f85ec996ad00dd38d2302 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 2 Aug 2024 20:24:16 +0200 Subject: Add settings page labels --- include/Theme.hpp | 1 + include/gui/Label.hpp | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 include/gui/Label.hpp (limited to 'include') diff --git a/include/Theme.hpp b/include/Theme.hpp index 1221b7f..37c9e82 100644 --- a/include/Theme.hpp +++ b/include/Theme.hpp @@ -12,6 +12,7 @@ namespace gsr { mgl::Color tint_color = mgl::Color(118, 185, 0); mgl::Color scrollable_page_bg_color = mgl::Color(38, 43, 47); + mgl::Color text_color = mgl::Color(255, 255, 255); }; void init_theme(const gsr::GsrInfo &gsr_info); diff --git a/include/gui/Label.hpp b/include/gui/Label.hpp new file mode 100644 index 0000000..a94ff96 --- /dev/null +++ b/include/gui/Label.hpp @@ -0,0 +1,23 @@ +#pragma once + +#include "Widget.hpp" + +#include +#include + +namespace gsr { + class Label : public Widget { + public: + // TODO: Allow specifying max width, at which either a line-break should occur or elipses should show + Label(mgl::Font *font, const char *text, mgl::Color color); + Label(const Label&) = delete; + Label& operator=(const Label&) = delete; + + bool on_event(mgl::Event &event, mgl::Window &window, mgl::vec2f offset) override; + void draw(mgl::Window &window, mgl::vec2f offset) override; + + mgl::vec2f get_size(); + private: + mgl::Text text; + }; +} \ No newline at end of file -- cgit v1.2.3