Former-commit-id: 3fb462b92a8b1190c974f16079458fccbcc0135a [formerly 4092a64ff127dd696ea0f824687670a18367e28f] [formerly 926df48c28edb7db9682e4a16613f5a6e12e8f26 [formerly 2cff9c75a1b974b6407fd0ff577dd50d620f18e2]] Former-commit-id: 3555eea4a1e89a4c6e750349c55e603b6d4dc237 [formerly b60dbd584782aafc339acaa666cd45508ef9891d] Former-commit-id: 0ddbe91d5bab84c65429e651ed8585d7129e04f0
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
|