Renderer.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef RENDERER_H
  2. #define RENDERER_H
  3. #include "math/MatrixStack.h"
  4. #include "rendering/ColorRenderer.h"
  5. #include "rendering/FontRenderer.h"
  6. #include "rendering/Shader.h"
  7. class Renderer final {
  8. Shader& shader;
  9. bool texture;
  10. bool color;
  11. MatrixStack<10> stack;
  12. FontRenderer fontRenderer;
  13. ColorRenderer colorRenderer;
  14. public:
  15. Renderer(Shader& shader);
  16. void pop();
  17. void push();
  18. void update();
  19. Renderer& scale(float sx, float sy);
  20. Renderer& scale(float s);
  21. Renderer& translate(float tx, float ty);
  22. Renderer& translateX(float tx);
  23. Renderer& translateY(float ty);
  24. Renderer& translateTo(float tx, float ty);
  25. Renderer& rotate(float degrees);
  26. void setStringSize(int size);
  27. float drawString(float x, float y, const char* text);
  28. void drawTriangle(const ColorRenderer::Vertex& v1,
  29. const ColorRenderer::Vertex& v2,
  30. const ColorRenderer::Vertex& v3);
  31. void drawTriangle(float x1, float y1, float x2, float y2, float x3,
  32. float y3, Color4 color);
  33. void drawRectangle(const Vector2& pos, const Vector2& size, Color4 color);
  34. private:
  35. void setTextureMode(bool b);
  36. void setColorMode(bool b);
  37. };
  38. #endif