-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpaceHouses.cpp
More file actions
43 lines (34 loc) · 1.01 KB
/
SpaceHouses.cpp
File metadata and controls
43 lines (34 loc) · 1.01 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
#include "SpaceHouses.h"
SpaceHouses::SpaceHouses(sf::Texture& house, sf::Texture& hotel, sf::Vector2f house1,
sf::Vector2f house2, sf::Vector2f house3, float rotation)
{
this->houses.push_back(new House(house1, house, rotation));
this->houses.push_back(new House(house2, house, rotation));
this->houses.push_back(new House(house3, house, rotation));
this->houses.push_back(new House(house2, hotel, rotation));
}
SpaceHouses::~SpaceHouses()
{
for (auto& house : this->houses)
delete house;
}
bool SpaceHouses::isHouseActive(short a)
{
return this->houses[a]->isActive();
}
void SpaceHouses::setHouseActive(short a, bool state)
{
this->houses[a]->setActive(state);
}
void SpaceHouses::update(const float& dt, sf::Vector2f mousePosView)
{
for (auto& house : this->houses)
if (house->isActive())
house->update(dt, mousePosView);
}
void SpaceHouses::render(sf::RenderTarget* target)
{
for (auto& house : this->houses)
if(house->isActive())
house->render(target);
}