From 889efe51b26d505171d132097ac77a14ade5a101 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 30 Mar 2022 16:16:51 +0200 Subject: Initial commit, showing ui above target window --- include/gui/Button.hpp | 16 ++++++++++++++++ include/gui/Widget.hpp | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 include/gui/Button.hpp create mode 100644 include/gui/Widget.hpp (limited to 'include/gui') diff --git a/include/gui/Button.hpp b/include/gui/Button.hpp new file mode 100644 index 0000000..ac9aa5c --- /dev/null +++ b/include/gui/Button.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include "Widget.hpp" +#include + +namespace gsr { + class Button : public Widget { + public: + Button(mgl::vec2f size); + void on_event(mgl::Event &event, mgl::Window &window) override; + void draw(mgl::Window &window) override; + private: + mgl::vec2f size; + bool mouse_inside = false; + }; +} \ No newline at end of file diff --git a/include/gui/Widget.hpp b/include/gui/Widget.hpp new file mode 100644 index 0000000..cf81d69 --- /dev/null +++ b/include/gui/Widget.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include + +namespace mgl { + class Event; + class Window; +} + +namespace gsr { + class Widget { + public: + virtual ~Widget() = default; + + virtual void on_event(mgl::Event &event, mgl::Window &window) = 0; + virtual void draw(mgl::Window &window) = 0; + virtual void set_position(mgl::vec2f position); + protected: + mgl::vec2f position; + }; +} \ No newline at end of file -- cgit v1.2.3