31 StateManager(
void *obj,
const std::span<const StateManagerEntry> &entries)
32 : m_currentStateId(0), m_nextStateId(-1), m_currentFrame(0), m_entries(entries),
34 m_entryIds = std::span(
new u16[m_entries.size()], m_entries.size());
37 for (
auto &
id : m_entryIds) {
41 for (
size_t i = 0; i < m_entryIds.size(); ++i) {
42 m_entryIds[m_entries[i].id] = i;
47 delete[] m_entryIds.data();
51 if (m_nextStateId >= 0) {
52 m_currentStateId = m_nextStateId;
56 auto enterFunc = m_entries[m_entryIds[m_currentStateId]].onEnter;
62 auto calcFunc = m_entries[m_entryIds[m_currentStateId]].onCalc;
69 std::span<u16> m_entryIds;
70 std::span<const StateManagerEntry> m_entries;