fix(warnings): added _DataType argument to DefineState to improve type checking
This commit is contained in:
parent
2b1aa6236f
commit
3c647ccfc2
|
@ -11,11 +11,11 @@ struct State {
|
||||||
const State* (*const update)(void* data, float dt);
|
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() {\
|
static inline const State* _StateName() {\
|
||||||
TC_FN_TYPECHECK(void, enter_fn, void*);\
|
TC_FN_TYPECHECK(void, enter_fn, _DataType*);\
|
||||||
TC_FN_TYPECHECK(void, exit_fn, void*);\
|
TC_FN_TYPECHECK(void, exit_fn, _DataType*);\
|
||||||
TC_FN_TYPECHECK(const State*, update_fn, void*, float);\
|
TC_FN_TYPECHECK(const State*, update_fn, _DataType*, float);\
|
||||||
static const State instance = {\
|
static const State instance = {\
|
||||||
.enter = (void(*const)(void*)) enter_fn,\
|
.enter = (void(*const)(void*)) enter_fn,\
|
||||||
.exit = (void(*const)(void*)) exit_fn,\
|
.exit = (void(*const)(void*)) exit_fn,\
|
||||||
|
|
|
@ -67,7 +67,7 @@ extern void PlayerAnimationExit(Player* player);
|
||||||
|
|
||||||
extern void PlayerIdleEnter(Player* player);
|
extern void PlayerIdleEnter(Player* player);
|
||||||
|
|
||||||
DefineState(PlayerIdle,
|
DefineState(PlayerIdle, Player,
|
||||||
PlayerIdleEnter,
|
PlayerIdleEnter,
|
||||||
PlayerAnimationExit,
|
PlayerAnimationExit,
|
||||||
PlayerAnimationUpdate
|
PlayerAnimationUpdate
|
||||||
|
|
Loading…
Reference in a new issue