diff --git a/core/src/state.h b/core/src/state.h index 0b9a9ee..ebaea05 100644 --- a/core/src/state.h +++ b/core/src/state.h @@ -11,11 +11,11 @@ struct State { const State* (*const update)(void* data, float dt); }; -#define DefineState(_StateName, enter_fn, exit_fn, update_fn)\ +#define DefineState(_StateName, _DataType, enter_fn, exit_fn, update_fn)\ static inline const State* _StateName() {\ - TC_FN_TYPECHECK(void, enter_fn, void*);\ - TC_FN_TYPECHECK(void, exit_fn, void*);\ - TC_FN_TYPECHECK(const State*, update_fn, void*, float);\ + TC_FN_TYPECHECK(void, enter_fn, _DataType*);\ + TC_FN_TYPECHECK(void, exit_fn, _DataType*);\ + TC_FN_TYPECHECK(const State*, update_fn, _DataType*, float);\ static const State instance = {\ .enter = (void(*const)(void*)) enter_fn,\ .exit = (void(*const)(void*)) exit_fn,\ diff --git a/game/src/player.h b/game/src/player.h index 03d3bf5..41194e6 100644 --- a/game/src/player.h +++ b/game/src/player.h @@ -67,7 +67,7 @@ extern void PlayerAnimationExit(Player* player); extern void PlayerIdleEnter(Player* player); -DefineState(PlayerIdle, +DefineState(PlayerIdle, Player, PlayerIdleEnter, PlayerAnimationExit, PlayerAnimationUpdate