2014-12-15 16:47:30 +01:00
|
|
|
/*
|
|
|
|
* =====================================================================================
|
|
|
|
*
|
|
|
|
* Filename: ApplicationState.hpp
|
|
|
|
*
|
2018-06-05 01:24:54 +02:00
|
|
|
* Description:
|
2014-12-15 16:47:30 +01:00
|
|
|
*
|
2018-06-05 16:17:40 +02:00
|
|
|
* Created: 05/06/2018 15:45:26
|
2014-12-15 16:47:30 +01:00
|
|
|
*
|
2018-06-05 16:17:40 +02:00
|
|
|
* Author: Quentin Bazin, <quent42340@gmail.com>
|
2014-12-15 16:47:30 +01:00
|
|
|
*
|
|
|
|
* =====================================================================================
|
|
|
|
*/
|
|
|
|
#ifndef APPLICATIONSTATE_HPP_
|
|
|
|
#define APPLICATIONSTATE_HPP_
|
|
|
|
|
2018-12-26 18:36:46 +01:00
|
|
|
#include <SFML/Window/Event.hpp>
|
|
|
|
|
2018-06-14 23:36:01 +02:00
|
|
|
#include "IDrawable.hpp"
|
2018-06-21 09:00:53 +02:00
|
|
|
#include "Transformable.hpp"
|
2018-06-14 02:38:02 +02:00
|
|
|
|
|
|
|
class ApplicationStateStack;
|
|
|
|
|
2018-06-21 09:00:53 +02:00
|
|
|
class ApplicationState : public IDrawable, public Transformable {
|
2014-12-15 16:47:30 +01:00
|
|
|
public:
|
2015-07-17 17:08:53 +02:00
|
|
|
ApplicationState(ApplicationState *parent = nullptr) : m_parent(parent) {}
|
2018-06-14 02:38:02 +02:00
|
|
|
ApplicationState(const ApplicationState &) = delete;
|
|
|
|
ApplicationState(ApplicationState &&) = default;
|
2018-06-05 16:17:40 +02:00
|
|
|
virtual ~ApplicationState() = default;
|
2018-06-05 01:24:54 +02:00
|
|
|
|
2018-06-14 02:38:02 +02:00
|
|
|
ApplicationState &operator=(const ApplicationState &) = delete;
|
|
|
|
ApplicationState &operator=(ApplicationState &&) = default;
|
|
|
|
|
2018-12-26 18:36:46 +01:00
|
|
|
virtual void onEvent(const sf::Event &) {}
|
2018-06-14 02:38:02 +02:00
|
|
|
|
2014-12-15 16:47:30 +01:00
|
|
|
virtual void update() = 0;
|
2018-06-05 01:24:54 +02:00
|
|
|
|
2018-06-14 02:38:02 +02:00
|
|
|
void setStateStack(ApplicationStateStack *stateStack) { m_stateStack = stateStack; }
|
|
|
|
|
2015-07-17 17:08:53 +02:00
|
|
|
protected:
|
|
|
|
ApplicationState *m_parent = nullptr;
|
2018-06-14 02:38:02 +02:00
|
|
|
|
|
|
|
ApplicationStateStack *m_stateStack = nullptr;
|
2014-12-15 16:47:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // APPLICATIONSTATE_HPP_
|