-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTurnIndicator.cpp
More file actions
26 lines (22 loc) · 809 Bytes
/
Copy pathTurnIndicator.cpp
File metadata and controls
26 lines (22 loc) · 809 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
#include "TurnIndicator.h"
TurnIndicator::TurnIndicator(Display* display, SDL_Rect location)
{
this->location = location;
text = new Text(display->renderer, "Turn: you", 40, Renderable::GetUncenteredRect(location), {255, 255, 255, 255});
this->display = display;
display->AddRenderable(text);
}
void TurnIndicator::setTurn(int turn)
{
this->turn = turn;
if (turn == 0)
{
this->text->ChangeText(display->renderer, "Turn: you");
this->text->SetLocation(Renderable::GetUncenteredRect({ location.x, location.y, text->GetLocation().w, text->GetLocation().h }));
}
else
{
this->text->ChangeText(display->renderer, ("Turn: " + std::to_string(turn)).c_str());
this->text->SetLocation(Renderable::GetUncenteredRect({ location.x, location.y, text->GetLocation().w, text->GetLocation().h }));
}
}