-
Notifications
You must be signed in to change notification settings - Fork 0
/
toolText.h
65 lines (48 loc) · 1.04 KB
/
toolText.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef TOOLTEXT_H
#define TOOLTEXT_H
#include "tools.h"
#include <GL/glut.h>
#include <iostream>
toolText::toolText(float x, float y, float r, float g, float b, string txt) {
newX = x;
newY = y;
newR = r;
newG = g;
newB = b;
text = txt;
}
toolText::~toolText() {}
float toolText::getX() {
return newX;
}
float toolText::getY() {
return newY;
}
float toolText::getR() {
return newR;
}
float toolText::getG() {
return newG;
}
float toolText::getB() {
return newB;
}
string toolText::getText() {
return text;
}
void toolText::setColor(float r, float g, float b) {
newR = r;
newG = g;
newB = b;
}
void toolText::writeBitmapString(void *font, const std::string &str) {
for (char c: str) {
glutBitmapCharacter(font, c);
}
}
void toolText::createText(float posX, float posY, const std::string &txt) {
glRasterPos3f(posX, posY, 0.0);
static long font = (long) GLUT_BITMAP_8_BY_13; // Font selection.
writeBitmapString((void *) font, txt);
}
#endif // TOOLTEXT_H