-
Notifications
You must be signed in to change notification settings - Fork 0
/
Text.h
49 lines (37 loc) · 880 Bytes
/
Text.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// Created by Marrony Neris on 11/7/15.
//
#ifndef TEXT_H
#define TEXT_H
#include "Device.h"
#include "Allocator.h"
struct Font {
int id;
};
class TextManager {
public:
TextManager(HeapAllocator& allocator, Device& device);
~TextManager();
void printText(Font fontId, Framebuffer framebuffer, const float color[3], float x, float y, const char* fmt, ...);
Font loadFont(const char* fontface, int height);
private:
struct Character {
Texture2D texture;
int size[2];
int bearing[2];
int advance;
};
struct FontFace {
int height;
const char* fontface;
Character characters[128];
};
HeapAllocator& allocator;
Device& device;
VertexArray vertexArray;
VertexBuffer vertexBuffer;
Program program;
FontFace* fonts[10];
int fontCount;
};
#endif //TEXT_H