Kinoko
A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
StateManager.hh
1
#pragma once
2
3
#include "game/field/obj/ObjectBase.hh"
4
5
#include <type_traits>
6
7
namespace
Field
{
8
9
template
<
typename
T>
10
struct
StateManagerEntry
{
11
using
StateEnterFunc = void (T::*)();
12
using
StateCalcFunc = void (T::*)();
13
14
u16
id;
15
StateEnterFunc onEnter;
16
StateCalcFunc onCalc;
17
};
18
19
template
<
typename
T>
20
class
StateManagerBase
{
21
public
:
22
StateManagerBase
() : m_currentStateId(0), m_nextStateId(-1), m_currentFrame(0), m_obj(
nullptr
) {
23
// Concepts don't work here due to CRTP causing incomplete class type use.
24
STATIC_ASSERT((std::is_base_of_v<ObjectBase, T>));
25
}
26
27
virtual
~StateManagerBase
() {}
28
29
protected
:
30
u16
m_currentStateId;
31
s32
m_nextStateId;
32
u32
m_currentFrame;
33
std::span<u16> m_entryIds;
34
std::span<const StateManagerEntry<T>> m_entries;
35
const
T *m_obj;
36
};
37
38
// Keep the constructor from above
39
template
<
typename
T>
40
class
StateManager
:
public
StateManagerBase
<T> {
41
public
:
42
StateManager
() =
default
;
43
~StateManager
() =
default
;
44
};
45
46
}
// namespace Field
Field::StateManagerBase
Definition
StateManager.hh:20
Field::StateManager
Definition
StateManager.hh:40
int32_t
uint16_t
uint32_t
Field
Pertains to collision.
Definition
BoxColManager.cc:8
Field::StateManagerEntry
Definition
StateManager.hh:10
game
field
StateManager.hh
Made by
Malleo
. Logo by
vabold
. Website generated by
Doxygen
1.12.0