1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #ifndef RENDERER_H
- #define RENDERER_H
- #include "gaming-core/math/Vector.h"
- #include "gaming-core/rendering/FileTexture.h"
- #include "gaming-core/rendering/VertexBuffer.h"
- #include "gaming-core/utils/Buffer.h"
- #include "gaming-core/utils/Color.h"
- class Renderer final {
- VertexBuffer vertexBuffer;
- Buffer buffer;
- FileTexture font;
- Color4 color;
- const char* text;
- int index;
- int maxIndex;
- float x;
- float y;
- int vertices;
- public:
- Renderer();
- void drawString(const Vector2& pos, const char* text, int limit = -1);
- Vector2 getStringSize(const char* text, int limit = -1);
- void drawRectangle(const Vector2& pos, const Vector2& size, Color4 c);
- int charsInSpace(float width);
- private:
- void setupStringRead(const char* s, int limit);
- void setupString(const Vector2& pos, const char* s, int limit);
- bool hasStringData() const;
- char32_t readUnicode();
- bool readColor(char32_t c);
- void addChar(char32_t c);
- void update();
- };
- #endif
|