-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCscore.cpp
More file actions
executable file
·28 lines (22 loc) · 992 Bytes
/
Cscore.cpp
File metadata and controls
executable file
·28 lines (22 loc) · 992 Bytes
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
#include "Cscore.h"
Cscore::Cscore(): text(), score(0) {
//empty
}
OPENGL::vanillaPoint* Cscore::draw(Copengl &opengl, OPENGL::vanillaPoint* freeSpace) {
freeSpace = text.draw_string(SCORE::TEXT, SCORE::X, SCORE::Y, opengl, freeSpace);
float endOfTextOffset = SCORE::LENGTH_OF_TEXT*(opengl.convert_pixel_width(IMAGES::LETTERS::WIDTH)+opengl.convert_pixel_width(TEXT::SPACING));
freeSpace = text.draw_number(score, SCORE::X+endOfTextOffset, SCORE::Y, opengl, freeSpace);
for (int iii = 0; iii < SCORE::EXTRA_ZEROS; iii++) {
freeSpace = text.draw_digit(0, SCORE::X+endOfTextOffset+(TEXT::NUM_DIGITS+iii)*opengl.convert_pixel_width(IMAGES::DIGITS::WIDTH + TEXT::SPACING + TEXT::DIGIT_PADDING_X + TEXT::DIGIT_EXTRA_SPACING), SCORE::Y, opengl, freeSpace);
}
return freeSpace;
}
void Cscore::add(int change) {
score += change;
}
unsigned long Cscore::get_score() {
return score;
}
void Cscore::set_score(unsigned long setTo) {
score = setTo;
}