New Super Mario Bros. U Headers
Loading...
Searching...
No Matches
FStateFactory.h
Go to the documentation of this file.
1#pragma once
2
3#include <state/FState.h>
4#include <state/IStateFactory.h>
5
6template <typename T>
8{
9public:
11 : mState(obj)
12 {
13 }
14
16 {
17 }
18
19 IState* buildWithInitialize(const StateID& state_id) override
20 {
21 mState.setStateID(static_cast<const FStateID<T>*>(&state_id));
22 mState.initialize();
23 return &mState;
24 }
25
26 void disposeWithFinalize(IState*& state) override
27 {
28 mState.finalize();
29 mState.setStateID(nullptr);
30 state = nullptr;
31 }
32
33 IState* build(const StateID& state_id) override
34 {
35 mState.setStateID(static_cast<const FStateID<T>*>(&state_id));
36 return &mState;
37 }
38
39 void dispose(IState*& state) override
40 {
41 mState.setStateID(nullptr);
42 state = nullptr;
43 }
44
45 void initializeState(IState* state) override
46 {
47 static_cast<FState<T>*>(state)->initialize();
48 }
49
50protected:
52};
Definition FStateFactory.h:8
void initializeState(IState *state) override
Definition FStateFactory.h:45
FState< T > mState
Definition FStateFactory.h:51
void disposeWithFinalize(IState *&state) override
Definition FStateFactory.h:26
FStateFactory(T &obj)
Definition FStateFactory.h:10
~FStateFactory() override
Definition FStateFactory.h:15
IState * buildWithInitialize(const StateID &state_id) override
Definition FStateFactory.h:19
IState * build(const StateID &state_id) override
Definition FStateFactory.h:33
void dispose(IState *&state) override
Definition FStateFactory.h:39