aboutsummaryrefslogtreecommitdiff
path: root/include/gui
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-05-11 14:24:52 +0200
committerdec05eba <dec05eba@protonmail.com>2021-05-11 14:24:52 +0200
commite308d77b06405b91885cf6f97c0dc2a1b70679ef (patch)
tree7fb0ed73c20354f3e0ff49ebb199e33ebc3427f7 /include/gui
parent6b90f55f4dc14b9d39fa0dbf6b82b3c12ccc29d9 (diff)
Improve file saving gui
Diffstat (limited to 'include/gui')
-rw-r--r--include/gui/Button.hpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/gui/Button.hpp b/include/gui/Button.hpp
new file mode 100644
index 0000000..ba6997b
--- /dev/null
+++ b/include/gui/Button.hpp
@@ -0,0 +1,40 @@
+#pragma once
+
+#include "../RoundedRectangle.hpp"
+#include <string>
+#include <SFML/Graphics/Text.hpp>
+
+namespace sf {
+ class Event;
+ class Font;
+ class RenderTarget;
+ class Shader;
+}
+
+namespace QuickMedia {
+ enum ButtonEvent {
+ BUTTON_EVENT_NONE = 0,
+ BUTTON_EVENT_CLICKED = 1
+ };
+
+ class Button {
+ public:
+ Button(const std::string &label, sf::Font *font, unsigned int character_size, float width, sf::Shader *rounded_rectangle_shader, float scale = 1.0f);
+
+ ButtonEvent on_event(sf::Event &event);
+ void draw(sf::RenderTarget &target);
+
+ void set_background_color(sf::Color color);
+ void set_position(sf::Vector2f pos);
+
+ sf::Vector2f get_position() const;
+ float get_width() const;
+ float get_height() const;
+ private:
+ sf::Text label;
+ RoundedRectangle background;
+ sf::Color background_color;
+ float scale;
+ bool clicked_inside = false;
+ };
+} \ No newline at end of file