2016-04-09 13:53:12 +00:00
|
|
|
#include "state.hpp"
|
2016-04-09 02:36:30 +00:00
|
|
|
#include "manager.hpp"
|
2016-03-28 18:02:23 +00:00
|
|
|
|
2016-04-09 13:53:12 +00:00
|
|
|
State::State(Manager& manager) : manager(manager) {}
|
|
|
|
State::~State() {}
|
2016-04-09 00:32:11 +00:00
|
|
|
|
2016-04-09 13:53:12 +00:00
|
|
|
void State::frame(const std::vector<sf::Event>& events) {
|
2016-04-09 00:32:11 +00:00
|
|
|
// traitement des événements
|
|
|
|
for (unsigned int i = 0; i < events.size(); i++) {
|
|
|
|
processEvent(events[i]);
|
|
|
|
}
|
|
|
|
}
|
2016-04-09 02:36:30 +00:00
|
|
|
|
2016-04-09 13:53:12 +00:00
|
|
|
Manager& State::getManager() {
|
2016-04-09 02:36:30 +00:00
|
|
|
return manager;
|
|
|
|
}
|
|
|
|
|
|
|
|
// raccourcis vers des méthodes du gestionnaire
|
2016-04-09 13:53:12 +00:00
|
|
|
ResourceManager& State::getResourceManager() {
|
2016-04-09 02:36:30 +00:00
|
|
|
return manager.getResourceManager();
|
|
|
|
}
|
|
|
|
|
2016-04-09 13:53:12 +00:00
|
|
|
sf::RenderWindow& State::getWindow() {
|
2016-04-09 02:36:30 +00:00
|
|
|
return manager.getWindow();
|
|
|
|
}
|
|
|
|
|
2016-04-09 13:53:12 +00:00
|
|
|
bool State::isKeyPressed(sf::Keyboard::Key key) const {
|
2016-04-09 02:36:30 +00:00
|
|
|
return manager.isKeyPressed(key);
|
|
|
|
}
|