DirectRenderer.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef DIRECTRENDERER_H
  2. #define DIRECTRENDERER_H
  3. #include "../math/Matrix3D.h"
  4. #include "Texture.h"
  5. #include "Utils.h"
  6. using namespace std;
  7. class DirectRenderer
  8. {
  9. public:
  10. DirectRenderer();
  11. DirectRenderer(const DirectRenderer& orig);
  12. virtual ~DirectRenderer();
  13. void drawRectangle(float minX, float minY, float maxX, float maxY, float tMinX, float tMinY, float tMaxX, float tMaxY, IntColor c);
  14. void drawRectangle(float minX, float minY, float maxX, float maxY, IntColor c);
  15. void drawRectangle(float minX, float minY, float maxX, float maxY, float tMinX, float tMinY, float tMaxX, float tMaxY);
  16. float drawString(float x, float y, bool shadow, string& s);
  17. private:
  18. float addString(float x, float y, int& index, float* data, const IntColor* color, string& s);
  19. static const int FONTS_LENGTH = 3;
  20. Texture FONTS[FONTS_LENGTH]
  21. {
  22. Texture("resources/font8x8.png"), Texture("resources/font16x16.png"), Texture("resources/font24x24.png")
  23. };
  24. static const char COLOR_CHAR = '&';
  25. static const unsigned int FONT_SIZE = 8;
  26. static const unsigned int LINE_STEP = 1;
  27. static const unsigned int SHADOW_STEP = 1;
  28. static const unsigned int MAX_STRING_LENGTH = 1024;
  29. static const int OBJECT_LENGTH = 96;
  30. static const int BUFFER_LENGTH = 256 * 1024 * OBJECT_LENGTH;
  31. GLuint vba = 0;
  32. GLuint vbo = 0;
  33. unsigned int offset = BUFFER_LENGTH - OBJECT_LENGTH;
  34. };
  35. #endif