1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #ifndef BASE_GUI_H
- #define BASE_GUI_H
- #include "client/input/Controller.h"
- #include "client/rendering/Renderer.h"
- #include "client/rendering/ShaderMatrix.h"
- #include "input/TextInput.h"
- #include "math/Vector.h"
- #include "utils/List.h"
- #include "utils/Size.h"
- struct BaseGUI final {
- static const Vector2 FIXED_SIZE;
- const Size& size;
- TextInput*& textInput;
- const Controller& controller;
- float scale;
- Vector2 scaledSize;
- struct Input final {
- Vector2 pos;
- Vector2 size;
- TextInput text;
- };
- List<Input> inputs;
- BaseGUI(const Size& size, TextInput*& textInput,
- const Controller& controller);
- void tick();
- void updateScale(ShaderMatrix& sm);
- void render(float lag, ShaderMatrix& sm, Renderer& r);
- Vector2 round(const Vector2& v) const;
- void drawString(Renderer& r, const Vector2& pos, const char* s);
- Input& addInput();
- void drawCenteredString(Renderer& r, const Vector2& pos,
- const Vector2& size, const char* text);
- bool isIn(const Vector2& pos, const Vector2& size,
- const Vector2& point) const;
- };
- #endif
|