-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSceneChanger.cpp
More file actions
64 lines (53 loc) · 1.82 KB
/
SceneChanger.cpp
File metadata and controls
64 lines (53 loc) · 1.82 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "SceneChanger.hpp"
SceneChanger::SceneChanger() {}
SceneChanger::SceneChanger(sf::Vector2f pos, std::string nextScene, sf::Vector2f nextScenePos) :
_pos(pos),
_nextScene(nextScene),
_nextScenePos(nextScenePos) {}
SceneChanger::~SceneChanger() {}
std::string SceneChanger::getNextSceneName() {
return _nextScene;
_dir = directions::none;
}
sf::FloatRect SceneChanger::getRect(sf::Vector2f offset) {
return sf::FloatRect(_bound.left+offset.x, _bound.top+offset.y, _bound.width, _bound.height);
// Removed in da fiuter
// directions dir = getChangeDirection();
// sf::Vector2f localOffset(TILESIZE-4,TILESIZE-4);
// switch (dir) {
// case directions::left:
// localOffset.x *= -1;
// localOffset.y = 0;
// break;
// case directions::right:
// localOffset.y = 0;
// break;
// case directions::up:
// localOffset.x = 0;
// localOffset.y *= -1;
// break;
// case directions::down:
// localOffset.x = 0;
// break;
// default:
// localOffset.x = localOffset.y = 0;
// break;
// }
// return sf::FloatRect(_pos.x+offset.x+localOffset.x,_pos.y+offset.y+localOffset.y,TILESIZE,TILESIZE);
}
directions SceneChanger::getChangeDirection() {
return _dir;
}
void SceneChanger::setBounds(sf::FloatRect rect) {
_bound = rect;
}
void SceneChanger::setDirection(directions dir) {
_dir = dir;
}
directions SceneChanger::getOutsideDirection() {
if (int(_pos.x) == 0) return directions::left;
else if (int(_pos.y) == 0) return directions::up;
else if (int(_nextScenePos.x)==0) return directions::right;
else if (int(_nextScenePos.y)==0) return directions::down;
else return directions::directionsQtty;
}