Former-commit-id: 03f3085f56a0f547b21cd7bea75ff61541b0a8a5 [formerly 62183cea1c4c98a06a97de841f65bea108b9819d] [formerly ac9e462b7e2ccd7b5077dcdc315a97c42f5c2079 [formerly bf058e12205e1162a34dedabafe07390528edfb2]] Former-commit-id: 4fe43ca55388960e6506d978d5c82ed3cc696f14 [formerly 5084e4ffbe140a04855374d5f8c9bedbb6cc6b5a] Former-commit-id: c64604994a460fd8356bca46207b3e0d324b7ec4
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
|