123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #ifndef BASE_GUI_H
- #define BASE_GUI_H
- #include "client/input/Controller.h"
- #include "client/rendering/Renderer.h"
- #include "client/rendering/ShaderMatrix.h"
- #include "gaming-core/input/TextInput.h"
- #include "gaming-core/math/Vector.h"
- #include "gaming-core/utils/List.h"
- #include "gaming-core/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);
- float round(float f) const;
- void drawCenteredString(Renderer& r, float x, float y, const char* s);
- Input& addInput();
- bool isIn(const Vector2& pos, const Vector2& size,
- const Vector2& point) const;
- };
- #endif
|