![]() |
SANDAL2
A SDL2 Wrapper in C
|
Contains all structures related to actions on element. More...
Go to the source code of this file.
Classes | |
struct | Action |
struct | ListAction |
struct | ActionNode |
Typedefs | |
typedef struct Action | Action |
typedef struct ListAction | ListAction |
typedef struct ActionNode | ActionNode |
Functions | |
ListAction * | initAction (void(*action)(struct Element *, void *, double), double timing) |
Create an action based on its behavior and the time it should take. More... | |
ListAction * | setDataAction (ListAction *action, void *data, int shouldBeFreed) |
Set the data bound to an action, if the action list contains more than one action, this call will fail. More... | |
void | freeListAction (ListAction *action) |
Free the memory of a list action. More... | |
int | executeListAction (ListAction *action, struct Element *e, double time) |
Execute a list action. More... | |
ListAction * | generateChainedAction (ListAction *action,...) |
Generate a list of chained action (the nth action execute after the (n - 1)th ended) More... | |
ListAction * | generateParallelAction (ListAction *action,...) |
Generate a list of parallel action. More... | |
ListAction * | setForeverAction (ListAction *action, int isForever) |
Tells that the action should run forever or not (by default, an action does not run forever) More... | |
long long | addActionAtEndAction (ListAction *action, ListAction *toAdd) |
add an action at the end of another one More... | |
int | delActionToAction (ListAction *action, long long index) |
remove an action inside another More... | |
void | moveByActionFunction (struct Element *e, void *data, double spentTime) |
function used by moveByAction() and left public to be used in self made action functions More... | |
void | moveToActionFunction (struct Element *e, void *data, double spentTime) |
function used by moveToAction() and left public to be used in self made action functions More... | |
void | scaleByActionFunction (struct Element *e, void *data, double spentTime) |
function used by scaleByAction() and left public to be used in self made action functions More... | |
void | scaleToActionFunction (struct Element *e, void *data, double spentTime) |
function used by scaleToAction() and left public to be used in self made action functions More... | |
void | rotateByActionFunction (struct Element *e, void *data, double spentTime) |
function used by rotateByAction() and left public to be used in self made action functions More... | |
void | rotateToActionFunction (struct Element *e, void *data, double spentTime) |
function used by rotateToAction() and left public to be used in self made action functions More... | |
void | fadeInActionFunction (struct Element *e, void *data, double spentTime) |
function used by fadeInAction() and left public to be used in self made action functions More... | |
void | fadeOutActionFunction (struct Element *e, void *data, double spentTime) |
function used by fadeOutAction() and left public to be used in self made action functions More... | |
ListAction * | moveByAction (double x, double y, double time) |
Generate a ListAction doing a translation during a given time. More... | |
ListAction * | moveToAction (double x, double y, double time) |
Generate a ListAction doing a translation during a given time. More... | |
ListAction * | scaleByAction (double x, double y, double time) |
Generate a ListAction doing a scale XY (only X if y == 0, only Y if x == 0) during a given time. More... | |
ListAction * | scaleToAction (double w, double h, double time) |
Generate a ListAction doing a scale XY (only X if y == 0, only Y if x == 0) during a given time. More... | |
ListAction * | rotateByAction (double angle, double time) |
Generate a ListAction doing a rotation during a given time. More... | |
ListAction * | rotateToAction (double angle, double time) |
Generate a ListAction doing a rotation during a given time. More... | |
ListAction * | fadeInAction (int alpha, double time) |
Generate a ListAction doing a fade in during a given time. More... | |
ListAction * | fadeOutAction (int alpha, double time) |
Generate a ListAction doing a fade out during a given time. More... | |
Contains all structures related to actions on element.
long long addActionAtEndAction | ( | ListAction * | action, |
ListAction * | toAdd | ||
) |
add an action at the end of another one
action | : action to add another one to |
toAdd | : action to be added, it will be freed if the add succeeded |
int delActionToAction | ( | ListAction * | action, |
long long | index | ||
) |
remove an action inside another
action | : action to be modified |
index | : index of the action to be removed |
int executeListAction | ( | ListAction * | action, |
struct Element * | e, | ||
double | time | ||
) |
Execute a list action.
action | : list to be executed |
e | : element to call actions on |
time | : time elapsed since last call of this function |
ListAction* fadeInAction | ( | int | alpha, |
double | time | ||
) |
Generate a ListAction doing a fade in during a given time.
alpha | : value to reduce the element's alpha of |
time | : duration of the action |
void fadeInActionFunction | ( | struct Element * | e, |
void * | data, | ||
double | spentTime | ||
) |
function used by fadeInAction() and left public to be used in self made action functions
e | : element on which the action is called |
data | : a double* array of size 2 casted to void*. It MUST have the following format: [the delta to decrement alpha with, -1] the last value MUST be set to -1 before the first call, it will be modified inside the function those modifications NEEDS to be saved for the following calls |
spentTime | : total spent time since the beginning of the action (in percent from 0 to 1) |
ListAction* fadeOutAction | ( | int | alpha, |
double | time | ||
) |
Generate a ListAction doing a fade out during a given time.
alpha | : value to increase the element's alpha of |
time | : duration of the action |
void fadeOutActionFunction | ( | struct Element * | e, |
void * | data, | ||
double | spentTime | ||
) |
function used by fadeOutAction() and left public to be used in self made action functions
e | : element on which the action is called |
data | : a double* array of size 2 casted to void*. It MUST have the following format: [the delta to increment alpha with, -1] the last value MUST be set to -1 before the first call, it will be modified inside the function those modifications NEEDS to be saved for the following calls |
spentTime | : total spent time since the beginning of the action (in percent from 0 to 1) |
void freeListAction | ( | ListAction * | action | ) |
Free the memory of a list action.
action | : list to be freed |
ListAction* generateChainedAction | ( | ListAction * | action, |
... | |||
) |
Generate a list of chained action (the nth action execute after the (n - 1)th ended)
action... | : all list action of the list, needs to end by NULL |
ListAction* generateParallelAction | ( | ListAction * | action, |
... | |||
) |
Generate a list of parallel action.
action... | : all list action of the list, needs to end by NULL |
ListAction* initAction | ( | void(*)(struct Element *, void *, double) | action, |
double | timing | ||
) |
Create an action based on its behavior and the time it should take.
action | : behavior of the action, takes 3 parameters : the element on which it will be applied, the data of the action and the total time elapsed since its beginning (in percent from 0 to 1) |
timing | : duration of the action, it needs to be greater than 0 |
ListAction* moveByAction | ( | double | x, |
double | y, | ||
double | time | ||
) |
Generate a ListAction doing a translation during a given time.
x | : x offset |
y | : y offset |
time | : duration of the action |
void moveByActionFunction | ( | struct Element * | e, |
void * | data, | ||
double | spentTime | ||
) |
function used by moveByAction() and left public to be used in self made action functions
e | : element on which the action is called |
data | : a double* array of size 7 casted to void*. It MUST have the following format: [the x delta, the y delta, 0, 0, 0, 0, 0] the last values MUST be set to 0 before the first call, they will be modified inside the function those modifications NEEDS to be saved for the following calls |
spentTime | : total spent time since the beginning of the action (in percent from 0 to 1) |
ListAction* moveToAction | ( | double | x, |
double | y, | ||
double | time | ||
) |
Generate a ListAction doing a translation during a given time.
x | : new x value |
y | : new y value |
time | : duration of the action |
void moveToActionFunction | ( | struct Element * | e, |
void * | data, | ||
double | spentTime | ||
) |
function used by moveToAction() and left public to be used in self made action functions
e | : element on which the action is called |
data | : a double* array of size 4 casted to void*. It MUST have the following format: [the x new value, the y new value, 0, 0] the last two values MUST be set to 0 before the first call, they will be modified inside the function those modifications NEEDS to be saved for the following calls |
spentTime | : total spent time since the beginning of the action (in percent from 0 to 1) |
ListAction* rotateByAction | ( | double | angle, |
double | time | ||
) |
Generate a ListAction doing a rotation during a given time.
angle | : angle offset |
time | : duration of the action |
void rotateByActionFunction | ( | struct Element * | e, |
void * | data, | ||
double | spentTime | ||
) |
function used by rotateByAction() and left public to be used in self made action functions
e | : element on which the action is called |
data | : a double* array of size 2 casted to void*. It MUST have the following format: [the angle delta, 0, 0, 0] the last values MUST be set to 0 before the first call, it will be modified inside the function those modifications NEEDS to be saved for the following calls |
spentTime | : total spent time since the beginning of the action (in percent from 0 to 1) |
ListAction* rotateToAction | ( | double | angle, |
double | time | ||
) |
Generate a ListAction doing a rotation during a given time.
angle | : new angle |
time | : duration of the action |
void rotateToActionFunction | ( | struct Element * | e, |
void * | data, | ||
double | spentTime | ||
) |
function used by rotateToAction() and left public to be used in self made action functions
e | : element on which the action is called |
data | : a double* array of size 2 casted to void*. It MUST have the following format: [the new angle, 0] the last value MUST be set to 0 before the first call, it will be modified inside the function those modifications NEEDS to be saved for the following calls |
spentTime | : total spent time since the beginning of the action (in percent from 0 to 1) |
ListAction* scaleByAction | ( | double | x, |
double | y, | ||
double | time | ||
) |
Generate a ListAction doing a scale XY (only X if y == 0, only Y if x == 0) during a given time.
x | : scale value of x (percentage of modification with 1.0 == +100%) |
y | : scale value of y (percentage of modification with 1.0 == +100%) |
time | : duration of the action |
void scaleByActionFunction | ( | struct Element * | e, |
void * | data, | ||
double | spentTime | ||
) |
function used by scaleByAction() and left public to be used in self made action functions
e | : element on which the action is called |
data | : a double* array of size 4 casted to void*. It MUST have the following format: [the x scale value, the y scale value, 0, 0] the last two values MUST be set to 0 before the first call, they will be modified inside the function those modifications NEEDS to be saved for the following calls |
spentTime | : total spent time since the beginning of the action (in percent from 0 to 1) |
ListAction* scaleToAction | ( | double | w, |
double | h, | ||
double | time | ||
) |
Generate a ListAction doing a scale XY (only X if y == 0, only Y if x == 0) during a given time.
w | : new value of width |
h | : new value of height |
time | : duration of the action |
void scaleToActionFunction | ( | struct Element * | e, |
void * | data, | ||
double | spentTime | ||
) |
function used by scaleToAction() and left public to be used in self made action functions
e | : element on which the action is called |
data | : a double* array of size 4 casted to void*. It MUST have the following format: [the x scale value, the y scale value, 0, 0] the last two values MUST be set to 0 before the first call, they will be modified inside the function those modifications NEEDS to be saved for the following calls |
spentTime | : total spent time since the beginning of the action (in percent from 0 to 1) |
ListAction* setDataAction | ( | ListAction * | action, |
void * | data, | ||
int | shouldBeFreed | ||
) |
Set the data bound to an action, if the action list contains more than one action, this call will fail.
action | : action to bind data to |
data | : data to be bound to the action |
shouldBeFreed | : flag to tell whether or not the data should be freed |
ListAction* setForeverAction | ( | ListAction * | action, |
int | isForever | ||
) |
Tells that the action should run forever or not (by default, an action does not run forever)
action | : action to be modified |
isForever | : flag to set to the action |