DirectRenderer.h 1.6 KB

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