-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScoreView.cpp
42 lines (35 loc) · 962 Bytes
/
ScoreView.cpp
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
#include "ScoreView.h"
ScoreView::ScoreView(const Position &p) : m_rect{sf::Vector2f(135,52)}
{
m_rect.setPosition(p.getX(),p.getY());
m_rect.setOutlineColor(sf::Color(252, 232, 3));
m_rect.setFillColor(sf::Color(62, 64, 60));
m_rect.setOutlineThickness(6);
m_score = 0;
m_scoreFont.loadFromFile("ARCADE_I.TTF");
m_scoreText.setFont(m_scoreFont);
m_scoreText.setCharacterSize(24);
m_scoreText.setFillColor(sf::Color().White);
m_scoreText.setPosition(p.getX() + 50, p.getY() + 12.5);
setScoreText(0);
}
sf::RectangleShape &ScoreView::getScoreRectangle()
{
return m_rect;
}
sf::Text &ScoreView::getScoreText()
{
return m_scoreText;
}
void ScoreView::setScorePosition(Position p)
{
m_scoreText.setPosition(p.getX(),p.getY());
}
void ScoreView::setScoreText(const int score)
{
m_scoreText.setString(std::to_string(score));
}
Position ScoreView::getScorePosition()
{
return Position(m_scoreText.getPosition().x, m_scoreText.getPosition().y);
}