BaseGUI.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef BASE_GUI_H
  2. #define BASE_GUI_H
  3. #include "client/input/Controller.h"
  4. #include "client/rendering/Renderer.h"
  5. #include "client/rendering/ShaderMatrix.h"
  6. #include "gaming-core/input/TextInput.h"
  7. #include "gaming-core/math/Vector.h"
  8. #include "gaming-core/utils/List.h"
  9. #include "gaming-core/utils/Size.h"
  10. struct BaseGUI final {
  11. static const Vector2 FIXED_SIZE;
  12. const Size& size;
  13. TextInput*& textInput;
  14. const Controller& controller;
  15. float scale;
  16. Vector2 scaledSize;
  17. struct Input final {
  18. Vector2 pos;
  19. Vector2 size;
  20. TextInput text;
  21. };
  22. List<Input> inputs;
  23. BaseGUI(const Size& size, TextInput*& textInput,
  24. const Controller& controller);
  25. void tick();
  26. void updateScale(ShaderMatrix& sm);
  27. void render(float lag, ShaderMatrix& sm, Renderer& r);
  28. float round(float f) const;
  29. void drawCenteredString(Renderer& r, float x, float y, const char* s);
  30. Input& addInput();
  31. bool isIn(const Vector2& pos, const Vector2& size,
  32. const Vector2& point) const;
  33. };
  34. #endif