-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPauseMenu.cpp
54 lines (38 loc) · 984 Bytes
/
PauseMenu.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
43
44
45
46
47
48
49
50
51
52
53
54
#include "stdafx.h"
#include "PauseMenu.h"
//Constructors and Destructor:
PauseMenu::PauseMenu(sf::VideoMode& video_mode, sf::Font& font)
: Menu(video_mode, font)
{
// this->menuText.setString("PAUSED");
this->menuText.setPosition
(
(this->container.getPosition().x + (this->container.getSize().x / 2.f)) - (this->menuText.getGlobalBounds().width / 2.f),
this->container.getPosition().y + (this->menuText.getGlobalBounds().height * 2.f)
);
}
PauseMenu::~PauseMenu()
{
}
//Accessors:
//Functions:
void PauseMenu::update(const sf::Vector2i& mouse_position, const float& dt)
{
//Updating buttons
for (auto& i : this->buttons)
{
i.second->update(mouse_position, false, true);
i.second->updateButtonColor(dt);
}
}
void PauseMenu::render(sf::RenderTarget& target)
{
target.draw(this->background);
target.draw(this->container);
target.draw(this->menuText);
target.draw(this->logoSprite);
for (auto& i : this->buttons)
{
i.second->render(target);
}
}