OpenMiner/include/states/ApplicationState.hpp

47 lines
1.2 KiB
C++
Raw Normal View History

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_
#include <SFML/Window/Event.hpp>
#include "IDrawable.hpp"
#include "Transformable.hpp"
class ApplicationStateStack;
class ApplicationState : public IDrawable, public Transformable {
2014-12-15 16:47:30 +01:00
public:
ApplicationState(ApplicationState *parent = nullptr) : m_parent(parent) {}
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
ApplicationState &operator=(const ApplicationState &) = delete;
ApplicationState &operator=(ApplicationState &&) = default;
virtual void onEvent(const sf::Event &) {}
2014-12-15 16:47:30 +01:00
virtual void update() = 0;
2018-06-05 01:24:54 +02:00
void setStateStack(ApplicationStateStack *stateStack) { m_stateStack = stateStack; }
protected:
ApplicationState *m_parent = nullptr;
ApplicationStateStack *m_stateStack = nullptr;
2014-12-15 16:47:30 +01:00
};
#endif // APPLICATIONSTATE_HPP_