Former-commit-id: 20b8c0d81deb5d5c6aafc1c8d4d261b046f260c3 [formerly 37762eaaf8bd7c0b2434b65dfc62d95d4ae2db15] [formerly 5606a74447be6048ce12a502722a75c726cbf9ef [formerly cc437974e34587cf7f63d8fb7f5447473826ee1c]] Former-commit-id: 677c22d4ebcfa8bf22a85210712fea061dedc0da [formerly 3979a42d5a2ed3c2635ed654bf6f25b88c32a00e] Former-commit-id: 0d31a924eead5ed4f384fcbdde6411054c3a9b27
41 lines
1021 B
C++
41 lines
1021 B
C++
// Copyright (C) 2015 Jérôme Leclercq
|
|
// This file is part of the "Nazara Development Kit"
|
|
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
|
|
|
#pragma once
|
|
|
|
#ifndef NDK_STATEMACHINE_HPP
|
|
#define NDK_STATEMACHINE_HPP
|
|
|
|
#include <NDK/Prerequesites.hpp>
|
|
#include <NDK/State.hpp>
|
|
#include <memory>
|
|
|
|
namespace Ndk
|
|
{
|
|
class StateMachine
|
|
{
|
|
public:
|
|
inline StateMachine(std::shared_ptr<State> originalState);
|
|
StateMachine(const StateMachine&) = delete;
|
|
inline StateMachine(StateMachine&& fsm) = default;
|
|
inline ~StateMachine();
|
|
|
|
inline void ChangeState(std::shared_ptr<State> state);
|
|
|
|
inline const std::shared_ptr<State>& GetCurrentState() const;
|
|
|
|
inline bool Update(float elapsedTime);
|
|
|
|
inline StateMachine& operator=(StateMachine&& fsm) = default;
|
|
StateMachine& operator=(const StateMachine&) = delete;
|
|
|
|
private:
|
|
std::shared_ptr<State> m_currentState;
|
|
std::shared_ptr<State> m_nextState;
|
|
};
|
|
}
|
|
|
|
#include <NDK/StateMachine.inl>
|
|
|
|
#endif // NDK_STATEMACHINE_HPP
|