summaryrefslogtreecommitdiff
path: root/ui/iconButton.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-12-22 12:16:38 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-12-22 12:16:38 +0000
commite806d41c8703ddc4bcaf2186d0c1701bd1e1ada3 (patch)
tree1612baf22456c0b5a1bef82980177afb34b2756c /ui/iconButton.h
parentWindow handles UIComponent rendering (diff)
downloadilt-e806d41c8703ddc4bcaf2186d0c1701bd1e1ada3.tar.bz2
ilt-e806d41c8703ddc4bcaf2186d0c1701bd1e1ada3.tar.xz
ilt-e806d41c8703ddc4bcaf2186d0c1701bd1e1ada3.zip
Initial commit with some basic UI
Diffstat (limited to 'ui/iconButton.h')
-rw-r--r--ui/iconButton.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/ui/iconButton.h b/ui/iconButton.h
new file mode 100644
index 0000000..ec3f357
--- /dev/null
+++ b/ui/iconButton.h
@@ -0,0 +1,27 @@
+#ifndef ICONBUTTON_H
+#define ICONBUTTON_H
+
+#include "icon.h"
+#include "uiComponent.h"
+#include <GL/glew.h>
+#include <glm/glm.hpp>
+#include <string>
+
+class UIShader;
+union SDL_Event;
+
+static const constexpr glm::vec2 ICON_SIZE {32.F, 32.F};
+class IconButton : public UIComponent {
+public:
+ IconButton(const std::string & icon, glm::vec2 position, UIEvent click);
+
+ void render(const UIShader &, const Position & parentPos) const override;
+
+ bool handleInput(const SDL_Event & e, const Position & parentPos) override;
+
+ Icon icon;
+ UIEvent click;
+ GLuint m_vertexArrayObject, m_vertexArrayBuffer;
+};
+
+#endif