summaryrefslogtreecommitdiff
path: root/src/ui.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui.h')
-rw-r--r--src/ui.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/ui.h b/src/ui.h
new file mode 100644
index 0000000..16027ae
--- /dev/null
+++ b/src/ui.h
@@ -0,0 +1,46 @@
+#ifndef UI_H
+#define UI_H
+
+#include<SFML/Graphics.hpp>
+
+enum class MouseButton{
+ Left,
+ Mid,
+ Right
+};
+
+class UI{
+ public:
+ int hotItem, activeItem;
+
+ // TODO: Move MouseStatus other class
+ using MousePos = sf::Vector2i;
+ MousePos mousePos;
+ struct MouseState{
+ bool leftDown, rightDown, midDown;
+ MouseState(){
+ leftDown = false;
+ rightDown = false;
+ midDown = false;
+ }
+ } currentMouse, previousMouse;
+
+ bool mouseButtonPressed(MouseButton m);
+ bool mouseButtonReleased(MouseButton m);
+ bool mouseButtonIsDown(MouseButton m);
+ bool mouseButtonIsUp(MouseButton m);
+ sf::Vector2i mousePosition();
+ // end of MouseStatus
+
+ void handleEvent(const sf::Event &event);
+ void initImUI();
+ void finishImUI();
+ bool button(sf::RenderWindow *win, int id, const std::string &text,
+ sf::Vector2i pos, sf::Vector2i size);
+ bool radioButton(sf::RenderWindow *win, int id,
+ const std::string &text, bool state, sf::Vector2i pos,
+ sf::Vector2i size);
+
+};
+
+#endif // UI_H