/
State.cpp
54 lines (44 loc) · 1.1 KB
/
State.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
#include "State.h"
State::State(){
this->quit = false;
}
State::~State(){
}
const bool& State::getQuit() const{
return this->quit;
}
void State::checkForQuit(){
/* Escape tuþuna basýldýðý zaman mevcut state sonlanýr. */
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)){
this->quit = true;
}
}
void State::addEntity(Entity* entity){
this->entities.push_back(entity);
}
void State::createSolidEntities(){
this->map->createSolidObjects();
}
std::vector<Entity*> *State::getEntities(){
return &this->entities;
}
//bool checkCollision(Entity& e1, Entity& e2){
// if(e1.getSprite().getGlobalBounds().intersects(e2.getSprite().getGlobalBounds())){
// return true;
// }
// return false;
//}
//void State::checkEntityCollisions(){
// for(int i = 0; i < entities.size(); i++){
// entities[i]->clearCollisions();
// }
//
// for(int i = 0; i < entities.size()-1; i++){
// for(int j = i+1; j < entities.size(); j++){
// if( checkCollision(*entities[i], *entities[j])){
// entities[i]->getCollisions()->push_back(entities[j]);
// entities[j]->getCollisions()->push_back(entities[i]);
// }
// }
// }
//}