-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCText.cpp
More file actions
executable file
·48 lines (37 loc) · 1.03 KB
/
CText.cpp
File metadata and controls
executable file
·48 lines (37 loc) · 1.03 KB
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
//
// CText.cpp
// Third
//
// Created by Didrik Munther on 22/04/15.
// Copyright (c) 2015 Didrik Munther. All rights reserved.
//
#include "CText.h"
#include "NSurface.h"
#include "CCamera.h"
#include "CAssetManager.h"
#include <iostream>
CText::CText(std::string text, int size, std::string fontKey, Color color) :
_text(text), _size(size), _fontKey(fontKey), _color(color) {
}
void CText::onRender(int x, int y, CWindow* window, CCamera* camera) {
if(!camera->collision(x, y, _size, _size))
return;
if(CAssetManager::getFont(_fontKey) != nullptr)
NSurface::renderText(x - camera->offsetX(), y - camera->offsetY(), this, window);
}
void CText::onRender(int x, int y, CWindow* window) {
if(CAssetManager::getFont(_fontKey) != nullptr)
NSurface::renderText(x, y, this, window);
}
TTF_Font* CText::getFont() {
return CAssetManager::getFont(_fontKey);
}
int CText::getSize() {
return _size;
}
std::string* CText::getText() {
return &_text;
}
Color* CText::getColor() {
return &_color;
}