mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-01 11:06:44 +01:00
timeline: add TM_Action macro for defining action callbacks
This commit is contained in:
parent
1c66f219d8
commit
12faed0921
2 changed files with 3 additions and 2 deletions
|
@ -280,7 +280,7 @@ SYMBOL_EXPORT struct TM_Action* TM_AddBackgroundAction(struct Timeline* timeline
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Predefined action used by TM_AddQueuedBackgroundAction */
|
/*! \brief Predefined action used by TM_AddQueuedBackgroundAction */
|
||||||
static bool runinbackground(struct Game* game, struct TM_Action* action, enum TM_ActionState state) {
|
static TM_Action(RunInBackground) {
|
||||||
int* delay = (int*)TM_GetArg(action->arguments, 1);
|
int* delay = (int*)TM_GetArg(action->arguments, 1);
|
||||||
char* name = (char*)TM_GetArg(action->arguments, 2);
|
char* name = (char*)TM_GetArg(action->arguments, 2);
|
||||||
struct Timeline* timeline = (struct Timeline*)TM_GetArg(action->arguments, 3);
|
struct Timeline* timeline = (struct Timeline*)TM_GetArg(action->arguments, 3);
|
||||||
|
@ -305,7 +305,7 @@ SYMBOL_EXPORT struct TM_Action* TM_AddQueuedBackgroundAction(struct Timeline* ti
|
||||||
TM_WrapArg(int, del, delay);
|
TM_WrapArg(int, del, delay);
|
||||||
TM_WrapArg(bool, used, false);
|
TM_WrapArg(bool, used, false);
|
||||||
struct TM_Arguments* arguments = TM_AddToArgs(NULL, 6, (void*)func, del, strdup(name), (void*)timeline, args, used);
|
struct TM_Arguments* arguments = TM_AddToArgs(NULL, 6, (void*)func, del, strdup(name), (void*)timeline, args, used);
|
||||||
return TM_AddAction(timeline, runinbackground, arguments, "TM_BackgroundAction");
|
return TM_AddAction(timeline, RunInBackground, arguments, "TM_BackgroundAction");
|
||||||
}
|
}
|
||||||
|
|
||||||
SYMBOL_EXPORT void TM_AddDelay(struct Timeline* timeline, int delay) {
|
SYMBOL_EXPORT void TM_AddDelay(struct Timeline* timeline, int delay) {
|
||||||
|
|
|
@ -40,6 +40,7 @@ enum TM_ActionState {
|
||||||
|
|
||||||
struct TM_Action;
|
struct TM_Action;
|
||||||
typedef bool TM_ActionCallback(struct Game*, struct TM_Action*, enum TM_ActionState);
|
typedef bool TM_ActionCallback(struct Game*, struct TM_Action*, enum TM_ActionState);
|
||||||
|
#define TM_Action(x) bool x(struct Game* game, struct TM_Action* action, enum TM_ActionState state)
|
||||||
|
|
||||||
/*! \brief Timeline structure. */
|
/*! \brief Timeline structure. */
|
||||||
struct Timeline {
|
struct Timeline {
|
||||||
|
|
Loading…
Reference in a new issue