-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathState.cpp
More file actions
46 lines (29 loc) · 987 Bytes
/
Copy pathState.cpp
File metadata and controls
46 lines (29 loc) · 987 Bytes
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
#include "State.h"
State::State(sf::RenderWindow* window, std::stack<State*>* states){ // constructor
this->window = window;
this->states = states; // pointer of stack states
this->wantEnd = false;
}
State::~State(){ // destructor
}
// functions
void State::checkForEnd(){ // press ESC to end
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
this->wantEnd = true;
}
const bool & State::getEnd() const { // return boolean of wantEnd
return this->wantEnd;
}
void State::updatekeybinds(const float &dt) {
}
void State::updateMousePosition(){
this-> mousePosScreen = sf::Mouse::getPosition();
this-> mousePosWindow = sf::Mouse::getPosition(*this->window);
this-> mousePosView = this->window->mapPixelToCoords(sf::Mouse::getPosition(*this->window));
//std:: cout << " update mouse !" << std::endl;
}
void State::update(const float& dt){
this->updateMousePosition();
}
void State::render(sf::RenderTarget* target){
};