SANDAL2
A SDL2 Wrapper in C
Classes | Macros | Typedefs | Functions | Variables
Element.h File Reference

Contains all structures related to Elements. More...

#include "Clickable.h"
#include "Font.h"
#include "Window.h"
#include "DisplayCode.h"
#include "Sprite.h"
#include "Action.h"
Include dependency graph for Element.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Entry
 More informations about entry. More...
 
struct  PtrElement
 Structure used to store elements' pointers in a list of element. More...
 
struct  ListPtrElement
 List of PtrElement. More...
 
struct  EventElement
 Behaviors of an element to events. More...
 
struct  Element
 All the informations of an element. More...
 
struct  ListDCElement
 List (display code) of list (plan) of element. More...
 
struct  ListElement
 List of list (display code) of list (plan) of elements. More...
 

Macros

#define SANDAL2_FLIP_HOR   SDL_FLIP_HORIZONTAL
 
#define SANDAL2_FLIP_VER   SDL_FLIP_VERTICAL
 
#define SANDAL2_FLIP_NONE   SDL_FLIP_NONE
 
#define SANDAL2_FLIP   SDL_RendererFlip
 

Typedefs

typedef struct PtrElement PtrElement
 
typedef struct ListPtrElement ListPtrElement
 
typedef struct Element Element
 
typedef struct ListDCElement ListDCElement
 
typedef struct ListElement ListElement
 

Functions

ListElement_initListElement (void)
 Initialise a list of lists (display code) of lists (plan) of elements. More...
 
void _freeListElement (ListElement *l)
 free the memory of a list of lists (display code) of lists (plan) of elements More...
 
int addElement (Element *e)
 add an element to a list of lists (display code) of lists (plan) of elements More...
 
void _cleanElement (void)
 remove all elements that are marked as deletable (do not use it yourself, used in update)
 
int delElement (Element *e)
 mark an element as removable More...
 
void _freeElement (Element *e)
 Free the memory used by an element. More...
 
ElementcreateBlock (double x, double y, double width, double height, int color[4], int displayCode, int plan)
 Generate a non rotable rectangle like element. More...
 
ElementcreateText (double x, double y, double width, double height, double textSize, const char *font, const char *text, int textColor[4], int quality, int displayCode, int plan)
 Generate a text like element. More...
 
ElementcreateImage (double x, double y, double width, double height, const char *image, int displayCode, int plan)
 Generate an image like element. More...
 
ElementcreateImageBlock (double x, double y, double width, double height, int color[4], int displayCode, int plan)
 Generate a rotable rectangle like element (slower than createBlock()) More...
 
ElementcreateButton (double x, double y, double width, double height, double texteSize, const char *font, const char *text, int textColor[4], int quality, int colorBlock[4], int displayCode, int plan)
 Generate a button like element. More...
 
ElementcreateButtonImage (double x, double y, double width, double height, double texteSize, const char *font, const char *text, int textColor[4], int quality, const char *image, int displayCode, int plan)
 Generate a button like element with an image. More...
 
ElementcreateEntry (double x, double y, double width, double height, double texteSize, const char *font, const char *text, int textColor[4], int quality, int colorBlock[4], int displayCode, int plan, int min, int max, int isScripted)
 Generate a prompt like element. More...
 
ElementcreateEntryImage (double x, double y, double width, double height, double texteSize, const char *font, const char *text, int textColor[4], int quality, const char *image, int displayCode, int plan, int min, int max, int isScripted)
 Generate a prompt like element with an image. More...
 
int isDisplaiedElement (Element *e)
 tell whether or not the element can be displaied More...
 
int clearDisplayCode (int code)
 clear all elements of a display code in the current window More...
 
int getFlipStateElement (Element *e, SANDAL2_FLIP *flip)
 get the flip state of an element More...
 
int getCoordElement (Element *e, double *x, double *y)
 getter for the Element's coordinates More...
 
int getAngleElement (Element *e, double *a)
 getter for the Element's angle More...
 
int getDimensionElement (Element *e, double *w, double *h)
 getter for the Element's dimensions More...
 
int getRotationPointElement (Element *e, double *x, double *y)
 getter for the Element's rotation point More...
 
int getDataElement (Element *e, void **data)
 getter for the element's data More...
 
int isSelectedElement (Element *e, int *select)
 tells whether or not the element is selected More...
 
int getTextStyleElement (Element *e, int *style)
 
int getTextElement (Element *e, char **s)
 get the text of an element More...
 
int getColorElement (Element *e, int color[4])
 get the element's block color More...
 
int getWidthElement (Element *e, double *w)
 get the element's width More...
 
int getHeightElement (Element *e, double *h)
 get the element's height More...
 
int getCoordXElement (Element *e, double *x)
 get the element's x coordinate More...
 
int getCoordYElement (Element *e, double *y)
 get the element's y coordinate More...
 
int getAlphaElement (Element *e, int *alpha)
 get the element's color alpha value (from 0 for transparent to 255 for fully visible) More...
 
int setFontElement (Element *e, const char *font)
 set the element's font More...
 
int setTextElement (Element *e, const char *text)
 set the element's text More...
 
int setTextStyleElement (Element *e, int style)
 set the element's text font style More...
 
int setColorElement (Element *e, int color[4])
 set the element's block color More...
 
int setTextColorElement (Element *e, int color[4])
 set the element's text color More...
 
int setTextQualityElement (Element *e, int quality)
 set the element's text color More...
 
int setImageElement (Element *e, const char *image)
 set the element's image More...
 
int setImageSurfaceElement (Element *e, SDL_Surface *image)
 set the element's image with a 's texture More...
 
int replaceElement (Element *e, double x, double y)
 set the element's coordinates More...
 
int moveElement (Element *e, double x, double y)
 move an element More...
 
int setDimensionElement (Element *e, double width, double height)
 resize an element More...
 
int setTextSize (Element *e, double textSize)
 set the text size of the text of an element in this element More...
 
int addDisplayCodeElement (Element *e, int displayCode, int plan)
 add a display code to an element (if it did not already had it) More...
 
int delDisplayCodeElement (Element *e, int displayCode)
 remove a display code to an element (if it has it) More...
 
int setDisplayCodeElement (Element *e, int displayCode, int isDisplaied)
 set the isDisplaied option of a display code (if the element has it) More...
 
int setPlanElement (Element *e, int DisplayCode, int plan)
 set the plan of a display code (if the element has it) More...
 
int clearPlanDisplayCode (int code, int plan)
 clear all elements of a plan in a display code of the current window More...
 
int setActionElement (Element *e, void(*action)(Element *))
 set the continuous behaviour of an element More...
 
int setKeyPressedElement (Element *e, void(*keyPress)(Element *, SDL_Keycode c))
 set the behaviour of an element when a key is pressed More...
 
int setKeyReleasedElement (Element *e, void(*keyReleased)(Element *, SDL_Keycode c))
 set the behaviour of an element when a key is released More...
 
int setOnClickElement (Element *e, void(*onCLick)(Element *, int button))
 set the behaviour of an element when it is clicked More...
 
int setOnMouseMotionElement (Element *e, void(*onMouseMotion)(Element *))
 set the behaviour of an element when the mouse move on it More...
 
int setUnMouseMotionElement (Element *e, void(*unMouseMotion)(Element *))
 set the behaviour of an element when the mouse move out of it More...
 
int setUnClickElement (Element *e, void(*unCLick)(Element *, int button))
 set the behaviour of an element when it is unclicked More...
 
int setUnSelectElement (Element *e, void(*unSelect)(Element *))
 set the behaiour of an element when it is unselect More...
 
int setEndSpriteElement (Element *e, void(*endSprite)(Element *, int currentCode))
 set the behaviour of an element when it ends a sprite More...
 
int setEndActionElement (Element *e, void(*endAction)(Element *))
 set the behaviour of an element when its action list ends More...
 
int addElementToElement (Element *e, Element *add)
 add an element to another so that this other can modifie the first one More...
 
int delElementToElement (Element *e, Element *del)
 remove an element to another so that this other can not modifie the first one More...
 
int clearElementToElement (Element *e)
 remove all elements binded to an element More...
 
int addClickableElement (Element *e, Clickable *hb, int blocking)
 add a clickable zone to the element (or a blocking one) More...
 
int addAngleElement (Element *e, double a)
 increase the angle of an element More...
 
int rotateElement (Element *e, double a, double prX, double prY)
 directly rotate the element (more time consuming than adding angle) More...
 
int setAngleElement (Element *e, double a)
 set the angle of an element More...
 
int setRotationPointElement (Element *e, double x, double y)
 set the rotation point's coordinates of an element More...
 
int setDataElement (Element *e, void *data)
 set the element's data More...
 
int setFreeDataElement (Element *e, void(*freeData)(void *))
 set the element's freeing data's function (by default, set to free) More...
 
int freeDataElement (Element *e)
 free the element's data according to the element's freeing data behavior More...
 
int addAnimationElement (Element *e, int code)
 add an empty animation to the element More...
 
int delAnimationElement (Element *e, int code)
 remove an empty animation from the list More...
 
int addSpriteAnimationElement (Element *e, int code, int x, int y, int width, int height, int lifespan, int codeS)
 add a Sprite to the element More...
 
int delSpriteAnimationElement (Element *e, int code, int codeS)
 remove a Sprite in the element More...
 
int setLifeSpanSpriteAnimationElement (Element *e, int code, int codeS, unsigned lifespan)
 set the lifespan of a sprite More...
 
int nextSpriteElement (Element *e)
 go to te next sprite of the current animation of an element More...
 
int previousSpriteElement (Element *e)
 go to the previous sprite of the current animation of an element More...
 
int setWaySpriteAnimationElement (Element *e, int code, int side)
 set the way to go from a sprite to another (forward (1), backward (-1), no move (0)) More...
 
int nextAnimationElement (Element *e)
 go to te next animation of an element More...
 
int previousAnimationElement (Element *e)
 go to the previous animation of an element More...
 
int setAnimationElement (Element *e, int code)
 set the animation of an element More...
 
int setSpriteAnimationElement (Element *e, int codeS)
 set the sprite in the current animation of an element More...
 
int clearWindow (void)
 remove all elements from the current window More...
 
int setFlipStateElement (Element *e, SANDAL2_FLIP flip)
 set the flip state of an element More...
 
int setWidthElement (Element *e, double width)
 set the element's width More...
 
int setHeightElement (Element *e, double height)
 set the element's height More...
 
int setCoordXElement (Element *e, double x)
 set the element's x coordinate More...
 
int setCoordYElement (Element *e, double y)
 set the element's y coordinate More...
 
int setActionListElement (Element *e, ListAction *actions)
 Define a list of actions to apply to an element. More...
 
int setAlphaElement (Element *e, int alpha)
 set alpha of the element (255: completly visible, 0: completly transparent) More...
 
long long addActionToElement (Element *e, ListAction *action)
 add an action at the end of the element action list More...
 
int delActionToElement (Element *e, long long index)
 remove an action of the element action list More...
 
int setParentElement (Element *parent, Element *child)
 set the parent of an element in the scenary graph More...
 
int delParentElement (Element *child)
 Remove the parent of an element in the scenary graph. More...
 
int initIteratorElement (Element *e)
 initialize the element's iterator on all the elements it can modifie More...
 
ElementnextIteratorElement (Element *e)
 gives the current element's iterator's value and go to the next one More...
 
int initIterator (int displayCode)
 initialise the iterator of all elements having a common display code More...
 
ElementnextElement ()
 gives the current iterator's value and go to the next one More...
 
int setSizeEntry (Element *e, int size_min, int size_max)
 change the minimum and maximum size of a prompt (if a value is negative, it is not modified) More...
 
int setScriptedEntry (Element *e, int isScripted)
 set an element to crypted or uncrypted More...
 
int addCharEntry (Element *e, char c)
 add a character to a prompt More...
 
int delCharEntry (Element *e)
 remove a character to a prompt More...
 

Variables

ListWindow_windows_SANDAL2
 List of windows WARNING : Do not touch this list ... trust me.
 

Detailed Description

Contains all structures related to Elements.

Author
Baptiste PRUNIER (KLEVH)

Function Documentation

◆ _freeElement()

void _freeElement ( Element e)

Free the memory used by an element.

Parameters
e: element to be freed

◆ _freeListElement()

void _freeListElement ( ListElement l)

free the memory of a list of lists (display code) of lists (plan) of elements

Parameters
l: list to be freed

◆ _initListElement()

ListElement* _initListElement ( void  )

Initialise a list of lists (display code) of lists (plan) of elements.

Returns
An empty list of lists (display code) of lists (plan) of elements

◆ addActionToElement()

long long addActionToElement ( Element e,
ListAction action 
)

add an action at the end of the element action list

Parameters
e: element to add the action to
action: action to be added, it will be freed if the add succeeded
Returns
the index of the action added in the action list if it was added, -1 if it could not

◆ addAngleElement()

int addAngleElement ( Element e,
double  a 
)

increase the angle of an element

Parameters
e: element to be modified
a: angle increment
Returns
1 if it was impossible, 0 if not

◆ addAnimationElement()

int addAnimationElement ( Element e,
int  code 
)

add an empty animation to the element

Parameters
e: element
code: code of the new animation
Returns
0 if the animation could be added, 1 if not

◆ addCharEntry()

int addCharEntry ( Element e,
char  c 
)

add a character to a prompt

Parameters
e: element to be modified
c: character to be added
Returns
0 if it was possible, 1 if not

◆ addClickableElement()

int addClickableElement ( Element e,
Clickable hb,
int  blocking 
)

add a clickable zone to the element (or a blocking one)

Parameters
e: element to be modified
hb: clickable zone to be add
blocking: tells whether or not the clickable zone is a blocking one
Returns
1 if it was impossible, 0 if not

◆ addDisplayCodeElement()

int addDisplayCodeElement ( Element e,
int  displayCode,
int  plan 
)

add a display code to an element (if it did not already had it)

Parameters
e: element to be modified
displayCode: new display code
plan: plan linked to the new display code
Returns
1 if it was impossible, 0 if not

◆ addElement()

int addElement ( Element e)

add an element to a list of lists (display code) of lists (plan) of elements

Parameters
e: element to be add
Returns
0 if it could be done, 1 if not

◆ addElementToElement()

int addElementToElement ( Element e,
Element add 
)

add an element to another so that this other can modifie the first one

Parameters
e: element to be modified
add: element to be add
Returns
1 if it was impossible, 0 if not

◆ addSpriteAnimationElement()

int addSpriteAnimationElement ( Element e,
int  code,
int  x,
int  y,
int  width,
int  height,
int  lifespan,
int  codeS 
)

add a Sprite to the element

Parameters
e: element
x: abscissa coordinate of the top left corner of the sprite in its image
y: ordinate coordinate of the top left corner of the sprite in its image
width: width of the sprite in its image
height: height of the sprite in its image
lifespan: number of time the sprite should be displaied before going to the next sprite
codeS: identifier of the sprite to be added
Returns
0 if the sprite was correctly added, 1 if not

◆ clearDisplayCode()

int clearDisplayCode ( int  code)

clear all elements of a display code in the current window

Parameters
code: display code to be cleared
Returns
1 if there was an error, 0 if not

◆ clearElementToElement()

int clearElementToElement ( Element e)

remove all elements binded to an element

Parameters
e: element to be modified
Returns
1 if it was impossible, 0 if not

◆ clearPlanDisplayCode()

int clearPlanDisplayCode ( int  code,
int  plan 
)

clear all elements of a plan in a display code of the current window

Parameters
code: display code to be modified
plan: plan to be removed
Returns
0 if it succeeded, 1 if not

◆ clearWindow()

int clearWindow ( void  )

remove all elements from the current window

Returns
0 if it was possible, 1 if not

◆ createBlock()

Element* createBlock ( double  x,
double  y,
double  width,
double  height,
int  color[4],
int  displayCode,
int  plan 
)

Generate a non rotable rectangle like element.

Parameters
x: abscissa coordinate of its top left corner
y: ordinate coordinate of its top left corner
width: width of the element
height: height of the element
color: color of the rectangle (RGBA)
displayCode: display code of the rectangle
plan: plan of the rectangle

◆ createButton()

Element* createButton ( double  x,
double  y,
double  width,
double  height,
double  texteSize,
const char *  font,
const char *  text,
int  textColor[4],
int  quality,
int  colorBlock[4],
int  displayCode,
int  plan 
)

Generate a button like element.

Parameters
x: abscissa coordinate of its top left corner
y: ordinate coordinate of its top left corner
width: width of the element
height: height of the element
texteSize: proportion of the text in the rectangle (it is centered)
font: path to load the font to be used by the element
text: text of the element
textColor: color of the text (RGBA)
quality: quality of the text's texture (blended, shaded or solid)
colorBlock: color of the rectangle (RGBA)
displayCode: display code of the button
plan: plan of the button

◆ createButtonImage()

Element* createButtonImage ( double  x,
double  y,
double  width,
double  height,
double  texteSize,
const char *  font,
const char *  text,
int  textColor[4],
int  quality,
const char *  image,
int  displayCode,
int  plan 
)

Generate a button like element with an image.

Parameters
x: abscissa coordinate of its top left corner
y: ordinate coordinate of its top left corner
width: width of the element
height: height of the element
texteSize: proportion of the text in the rectangle (it is centered)
font: path to load the font to be used by the element
text: text of the element
textColor: color of the text (RGBA)
quality: quality of the text's texture (blended, shaded or solid)
image: path to load the image to be used by the element
displayCode: display code of the button
plan: plan of the button

◆ createEntry()

Element* createEntry ( double  x,
double  y,
double  width,
double  height,
double  texteSize,
const char *  font,
const char *  text,
int  textColor[4],
int  quality,
int  colorBlock[4],
int  displayCode,
int  plan,
int  min,
int  max,
int  isScripted 
)

Generate a prompt like element.

Parameters
x: abscissa coordinate of its top left corner
y: ordinate coordinate of its top left corner
width: width of the element
height: height of the element
texteSize: proportion of the text in the rectangle (it is centered)
font: path to load the font to be used by the element
text: text of the element
textColor: color of the text (RGBA)
quality: quality of the text's texture (blended, shaded or solid)
colorBlock: color of the rectangle (RGBA)
displayCode: display code of the button
plan: plan of the button
min: minimum number of character for the prompt to be validate
max: maximum number of character for the prompt to be validate
isScripted: flag which tells whether or not the prompt is cripted

◆ createEntryImage()

Element* createEntryImage ( double  x,
double  y,
double  width,
double  height,
double  texteSize,
const char *  font,
const char *  text,
int  textColor[4],
int  quality,
const char *  image,
int  displayCode,
int  plan,
int  min,
int  max,
int  isScripted 
)

Generate a prompt like element with an image.

Parameters
x: abscissa coordinate of its top left corner
y: ordinate coordinate of its top left corner
width: width of the element
height: height of the element
texteSize: proportion of the text in the rectangle (it is centered)
font: path to load the font to be used by the element
text: text of the element
textColor: color of the text (RGBA)
quality: quality of the text's texture (blended, shaded or solid)
image: path to load the image to be used by the element
displayCode: display code of the button
plan: plan of the button
min: minimum number of character for the prompt to be validate
max: maximum number of character for the prompt to be validate
isScripted: flag which tells whether or not the prompt is cripted

◆ createImage()

Element* createImage ( double  x,
double  y,
double  width,
double  height,
const char *  image,
int  displayCode,
int  plan 
)

Generate an image like element.

Parameters
x: abscissa coordinate of its top left corner
y: ordinate coordinate of its top left corner
width: width of the element
height: height of the element
image: path to load the image to be used by the element
displayCode: display code of the image
plan: plan of the image

◆ createImageBlock()

Element* createImageBlock ( double  x,
double  y,
double  width,
double  height,
int  color[4],
int  displayCode,
int  plan 
)

Generate a rotable rectangle like element (slower than createBlock())

Parameters
x: abscissa coordinate of its top left corner
y: ordinate coordinate of its top left corner
width: width of the element
height: height of the element
color: color of the rectangle (RGBA)
displayCode: display code of the rectangle
plan: plan of the rectangle

◆ createText()

Element* createText ( double  x,
double  y,
double  width,
double  height,
double  textSize,
const char *  font,
const char *  text,
int  textColor[4],
int  quality,
int  displayCode,
int  plan 
)

Generate a text like element.

Parameters
x: abscissa coordinate of its top left corner
y: ordinate coordinate of its top left corner
width: width of the element
height: height of the element
font: path to load the font to be used by the element
text: text of the element
textColor: color of the text (RGBA)
quality: quality of the text's texture (blended, shaded or solid)
displayCode: display code of the text
plan: plan of the text

◆ delActionToElement()

int delActionToElement ( Element e,
long long  index 
)

remove an action of the element action list

Parameters
e: element to be modified
index: index of the action to be removed
Returns
1 if it failed, 0 if not

◆ delAnimationElement()

int delAnimationElement ( Element e,
int  code 
)

remove an empty animation from the list

Parameters
l: list of animation
code: code of the animation to be removed
Returns
0 if the animation could be removed, 1 if not

◆ delCharEntry()

int delCharEntry ( Element e)

remove a character to a prompt

Parameters
e: element to be modified
Returns
0 if it was possible, 1 if not

◆ delDisplayCodeElement()

int delDisplayCodeElement ( Element e,
int  displayCode 
)

remove a display code to an element (if it has it)

Parameters
e: element to be modified
displayCode: display code to be removed
Returns
1 if it was impossible, 0 if not

◆ delElement()

int delElement ( Element e)

mark an element as removable

Parameters
e: element to be removed
Returns
0 if it could be done, 1 if not

◆ delElementToElement()

int delElementToElement ( Element e,
Element del 
)

remove an element to another so that this other can not modifie the first one

Parameters
e: element to be modified
del: element to be removed
Returns
1 if it was impossible, 0 if not

◆ delParentElement()

int delParentElement ( Element child)

Remove the parent of an element in the scenary graph.

Parameters
childelement to remove the parent from
Returns
1 if it failed, 0 if not

◆ delSpriteAnimationElement()

int delSpriteAnimationElement ( Element e,
int  code,
int  codeS 
)

remove a Sprite in the element

Parameters
e: element
codeS: code of the sprite to be removed
Returns
0 if the sprite was correctly removed, 1 if not

◆ freeDataElement()

int freeDataElement ( Element e)

free the element's data according to the element's freeing data behavior

Parameters
e: element to be modified
Returns
1 if it was impossible, 0 if not

◆ getAlphaElement()

int getAlphaElement ( Element e,
int *  alpha 
)

get the element's color alpha value (from 0 for transparent to 255 for fully visible)

Parameters
e: element to get the informations from
alpha: where to store the alpha value
Returns
1 if there was an error, 0 if not

◆ getAngleElement()

int getAngleElement ( Element e,
double *  a 
)

getter for the Element's angle

Parameters
e: element to get the angle
a: where the angle will be store
Returns
1 if there was an error, 0 if not

◆ getColorElement()

int getColorElement ( Element e,
int  color[4] 
)

get the element's block color

Parameters
e: element to get the informations from
color: where to store the block color
Returns
1 if there was an error, 0 if not

◆ getCoordElement()

int getCoordElement ( Element e,
double *  x,
double *  y 
)

getter for the Element's coordinates

Parameters
e: element to get the coordinates
x: where the abscissa coordinate will be store
y: where the ordinate coordinate will be store
Returns
1 if there was an error, 0 if not

◆ getCoordXElement()

int getCoordXElement ( Element e,
double *  x 
)

get the element's x coordinate

Parameters
e: element to get the informations from
x: where to store the x coordinate
Returns
1 if there was an error, 0 if not

◆ getCoordYElement()

int getCoordYElement ( Element e,
double *  y 
)

get the element's y coordinate

Parameters
e: element to get the informations from
y: where to store the y coordinate
Returns
1 if there was an error, 0 if not

◆ getDataElement()

int getDataElement ( Element e,
void **  data 
)

getter for the element's data

Parameters
e: element to get its data
data: where to store the element's data
Returns
0 if it could be done, 1 if not

◆ getDimensionElement()

int getDimensionElement ( Element e,
double *  w,
double *  h 
)

getter for the Element's dimensions

Parameters
e: element to get the dimensions
w: where the width will be store
h: where the height will be store
Returns
1 if there was an error, 0 if not

◆ getFlipStateElement()

int getFlipStateElement ( Element e,
SANDAL2_FLIP *  flip 
)

get the flip state of an element

Parameters
e: element to get the flip state
flip: where to store the flip state
Returns
0 if it succeeded, 1 if not

◆ getHeightElement()

int getHeightElement ( Element e,
double *  h 
)

get the element's height

Parameters
e: element to get the informations from
h: where to store the height
Returns
1 if there was an error, 0 if not

◆ getRotationPointElement()

int getRotationPointElement ( Element e,
double *  x,
double *  y 
)

getter for the Element's rotation point

Parameters
e: element to get the rotation point's coordinate
x: where the abscissa coordinate of the rotation point will be store
y: where the ordinate coordinate of the rotation point will be store
Returns
1 if there was an error, 0 if not

◆ getTextElement()

int getTextElement ( Element e,
char **  s 
)

get the text of an element

Parameters
e: the element to get the text from
s: where to store the text
Returns
1 if it failed, 0 if not

◆ getTextStyleElement()

int getTextStyleElement ( Element e,
int *  style 
)

get the element's text font style

Parameters
e: the element to get the font style
style: where to store the style
Returns
1 if there was an error, 0 if not

◆ getWidthElement()

int getWidthElement ( Element e,
double *  w 
)

get the element's width

Parameters
e: element to get the informations from
w: where to store the width
Returns
1 if there was an error, 0 if not

◆ initIterator()

int initIterator ( int  displayCode)

initialise the iterator of all elements having a common display code

Parameters
displayCode: common display code of the elements
Returns
1 if it succeeded, 0 if not

◆ initIteratorElement()

int initIteratorElement ( Element e)

initialize the element's iterator on all the elements it can modifie

Parameters
e: element from which to initialise the iterator
Returns
1 if it succeeded, 0 if not

◆ isDisplaiedElement()

int isDisplaiedElement ( Element e)

tell whether or not the element can be displaied

Parameters
e: element
Returns
1 if the element is displaied (even outside the window), 0 if not

◆ isSelectedElement()

int isSelectedElement ( Element e,
int *  select 
)

tells whether or not the element is selected

Parameters
e: element to get the information from
select: where to store the information
Returns
1 if there was an error, 0 if not

◆ moveElement()

int moveElement ( Element e,
double  x,
double  y 
)

move an element

Parameters
e: element to be modified
x: abscissa increment
y: ordinate increment
Returns
1 if it was impossible, 0 if not

◆ nextAnimationElement()

int nextAnimationElement ( Element e)

go to te next animation of an element

Parameters
e: element
Returns
0 if it was possible, 1 if not

◆ nextElement()

Element* nextElement ( )

gives the current iterator's value and go to the next one

Returns
the current element

◆ nextIteratorElement()

Element* nextIteratorElement ( Element e)

gives the current element's iterator's value and go to the next one

Parameters
e: element to be modified
Returns
the current element

◆ nextSpriteElement()

int nextSpriteElement ( Element e)

go to te next sprite of the current animation of an element

Parameters
e: element
Returns
0 if it was possible, 1 if not

◆ previousAnimationElement()

int previousAnimationElement ( Element e)

go to the previous animation of an element

Parameters
e: element
Returns
0 if it was possible, 1 if not

◆ previousSpriteElement()

int previousSpriteElement ( Element e)

go to the previous sprite of the current animation of an element

Parameters
e: element
Returns
0 if it was possible, 1 if not

◆ replaceElement()

int replaceElement ( Element e,
double  x,
double  y 
)

set the element's coordinates

Parameters
e: element to be modified
x: new abscissa coordinate
y: new ordinate coordinate

◆ rotateElement()

int rotateElement ( Element e,
double  a,
double  prX,
double  prY 
)

directly rotate the element (more time consuming than adding angle)

Parameters
e: element to rotate around a rotation point
a: angle of the rotation
prX: x coordinate of the rotation point
prY: y coordinate of the rotation point
Returns
1 if it failed, 0 if not

◆ setActionElement()

int setActionElement ( Element e,
void(*)(Element *)  action 
)

set the continuous behaviour of an element

Parameters
e: element to be modified
action: function to be called on each update call
Returns
1 if it was impossible, 0 if not

◆ setActionListElement()

int setActionListElement ( Element e,
ListAction actions 
)

Define a list of actions to apply to an element.

Parameters
e: element to be modified
actions: list of actions to set on the element (do not free it yourself)
Returns
1 if there was an error, 0 if not

◆ setAlphaElement()

int setAlphaElement ( Element e,
int  alpha 
)

set alpha of the element (255: completly visible, 0: completly transparent)

Parameters
e: element to modify
alpha: new alpha value of the element
Returns
1 if there was an error, 0 if not

◆ setAngleElement()

int setAngleElement ( Element e,
double  a 
)

set the angle of an element

Parameters
e: element to be modified
a: new angle of the element
Returns
1 if it was impossible, 0 if not

◆ setAnimationElement()

int setAnimationElement ( Element e,
int  code 
)

set the animation of an element

Parameters
e: element to be modified
code: code of the animation to set
Returns
0 if the animation is set, 1 if not

◆ setColorElement()

int setColorElement ( Element e,
int  color[4] 
)

set the element's block color

Parameters
e: element to be modified
color: new block color
Returns
1 if there was an error, 0 if not

◆ setCoordXElement()

int setCoordXElement ( Element e,
double  x 
)

set the element's x coordinate

Parameters
e: element to be modified
x: new x coordinate
Returns
1 if there was an error, 0 if not

◆ setCoordYElement()

int setCoordYElement ( Element e,
double  y 
)

set the element's y coordinate

Parameters
e: element to be modified
y: new y coordinate
Returns
1 if there was an error, 0 if not

◆ setDataElement()

int setDataElement ( Element e,
void *  data 
)

set the element's data

Parameters
e: element to be modified
data: new data of the element
Returns
1 if it was impossible, 0 if not

◆ setDimensionElement()

int setDimensionElement ( Element e,
double  width,
double  height 
)

resize an element

Parameters
e: element to be modified
width: new width
height: new height
Returns
1 if it was impossible, 0 if not

◆ setDisplayCodeElement()

int setDisplayCodeElement ( Element e,
int  displayCode,
int  isDisplaied 
)

set the isDisplaied option of a display code (if the element has it)

Parameters
e: element to be modified
displayCode: display code to be modified
isDisplaied: new isDisplaied option
Returns
1 if it was impossible, 0 if not

◆ setEndActionElement()

int setEndActionElement ( Element e,
void(*)(Element *)  endAction 
)

set the behaviour of an element when its action list ends

Parameters
e: element to be modified
unSelect: new behaviour
Returns
1 if it was impossible, 0 if not

◆ setEndSpriteElement()

int setEndSpriteElement ( Element e,
void(*)(Element *, int currentCode)  endSprite 
)

set the behaviour of an element when it ends a sprite

Parameters
e: element to be modified
endSprite: new behaviour
Returns
1 if it was impossible, 0 if not

◆ setFlipStateElement()

int setFlipStateElement ( Element e,
SANDAL2_FLIP  flip 
)

set the flip state of an element

Parameters
e: element to be modified
flip: new flip state of the element
Returns
0 if it was possible, 1 if not

◆ setFontElement()

int setFontElement ( Element e,
const char *  font 
)

set the element's font

Parameters
e: element to be modified
font: path of the new font
Returns
1 if there was an error, 0 if not

◆ setFreeDataElement()

int setFreeDataElement ( Element e,
void(*)(void *)  freeData 
)

set the element's freeing data's function (by default, set to free)

Parameters
e: element to be modified
freeData: new data freeing behavior
Returns
1 if it was impossible, 0 if not

◆ setHeightElement()

int setHeightElement ( Element e,
double  height 
)

set the element's height

Parameters
e: element to be modified
height: new height
Returns
1 if there was an error, 0 if not

◆ setImageElement()

int setImageElement ( Element e,
const char *  image 
)

set the element's image

Parameters
e: element to be modified
image: path of the new image
Returns
1 if it failed, 0 if it succeeded

◆ setImageSurfaceElement()

int setImageSurfaceElement ( Element e,
SDL_Surface *  image 
)

set the element's image with a 's texture

Parameters
e: element to be modified
image: surface of the new image
Returns
1 if it failed, 0 if it succeeded

◆ setKeyPressedElement()

int setKeyPressedElement ( Element e,
void(*)(Element *, SDL_Keycode c)  keyPress 
)

set the behaviour of an element when a key is pressed

Parameters
e: element to be modified
keyPress: function to be called when a key is pressed
Returns
1 if it was impossible, 0 if not

◆ setKeyReleasedElement()

int setKeyReleasedElement ( Element e,
void(*)(Element *, SDL_Keycode c)  keyReleased 
)

set the behaviour of an element when a key is released

Parameters
e: element to be modified
keyReleased: function to be called when a key is released
Returns
1 if it was impossible, 0 if not

◆ setLifeSpanSpriteAnimationElement()

int setLifeSpanSpriteAnimationElement ( Element e,
int  code,
int  codeS,
unsigned  lifespan 
)

set the lifespan of a sprite

Parameters
e: element
codeS: code of the sprite to be changed
lifespan: new number of time the sprite should be displaied before going to the next sprite
Returns
0 if the lifespan could be set, 1 if not

◆ setOnClickElement()

int setOnClickElement ( Element e,
void(*)(Element *, int button)  onCLick 
)

set the behaviour of an element when it is clicked

Parameters
e: element to be modified
onCLick: function to be called when it is clicked
Returns
1 if it was impossible, 0 if not

◆ setOnMouseMotionElement()

int setOnMouseMotionElement ( Element e,
void(*)(Element *)  onMouseMotion 
)

set the behaviour of an element when the mouse move on it

Parameters
e: element to be modified
onMouseMotion: function to be called when the mouse move on it
Returns
1 if it was impossible, 0 if not

◆ setParentElement()

int setParentElement ( Element parent,
Element child 
)

set the parent of an element in the scenary graph

Parameters
parentparent to add a child to
childchild to be added to the parent
Returns
1 if it failed, 0 if not

◆ setPlanElement()

int setPlanElement ( Element e,
int  DisplayCode,
int  plan 
)

set the plan of a display code (if the element has it)

Parameters
e: element to be modified
displayCode: display code to be modified
plan: new plan linked to the display code
Returns
1 if it was impossible, 0 if not

◆ setRotationPointElement()

int setRotationPointElement ( Element e,
double  x,
double  y 
)

set the rotation point's coordinates of an element

Parameters
e: element to be modified
x: new abscissa coordinate of the rotation point
y: new ordinate coordinate of the rotation point
Returns
1 if it was impossible, 0 if not

◆ setScriptedEntry()

int setScriptedEntry ( Element e,
int  isScripted 
)

set an element to crypted or uncrypted

Parameters
e: element to be modified
isScripted: crypted option
Returns
0 if it was possible, 1 if not

◆ setSizeEntry()

int setSizeEntry ( Element e,
int  size_min,
int  size_max 
)

change the minimum and maximum size of a prompt (if a value is negative, it is not modified)

Parameters
e: element to be modified
size_min: new minimum size of the prompt
size_max: new maximum size of the prompt
Returns
0 if it was possible, 1 if not

◆ setSpriteAnimationElement()

int setSpriteAnimationElement ( Element e,
int  codeS 
)

set the sprite in the current animation of an element

Parameters
e: element to be modified
codeS: code of the sprite to set
Returns
0 if the sprite is set, 1 if not

◆ setTextColorElement()

int setTextColorElement ( Element e,
int  color[4] 
)

set the element's text color

Parameters
e: element to be modified
color: new text color
Returns
1 if there was an error, 0 if not

◆ setTextElement()

int setTextElement ( Element e,
const char *  text 
)

set the element's text

Parameters
e: element to be modified
text: the new text
Returns
1 if there was an error, 0 if not

◆ setTextQualityElement()

int setTextQualityElement ( Element e,
int  quality 
)

set the element's text color

Parameters
e: element to be modified
quality: new text quality
Returns
1 if there was an error, 0 if not

◆ setTextSize()

int setTextSize ( Element e,
double  textSize 
)

set the text size of the text of an element in this element

Parameters
e: element to be modified
textSize: new size of the text (in percent)
Returns
1 if it was impossible, 0 if not

◆ setTextStyleElement()

int setTextStyleElement ( Element e,
int  style 
)

set the element's text font style

Parameters
e: the element to be modified
style: the style to apply
Returns
1 if there was an error, 0 if not

◆ setUnClickElement()

int setUnClickElement ( Element e,
void(*)(Element *, int button)  unCLick 
)

set the behaviour of an element when it is unclicked

Parameters
e: element to be modified
unCLick: function to be called when it is unclicked
Returns
1 if it was impossible, 0 if not

◆ setUnMouseMotionElement()

int setUnMouseMotionElement ( Element e,
void(*)(Element *)  unMouseMotion 
)

set the behaviour of an element when the mouse move out of it

Parameters
e: element to be modified
unMouseMotion: function to be called when the mouse move out it
Returns
1 if it was impossible, 0 if not

◆ setUnSelectElement()

int setUnSelectElement ( Element e,
void(*)(Element *)  unSelect 
)

set the behaiour of an element when it is unselect

Parameters
e: element to be modified
unSelect: new behaviour
Returns
1 if it was impossible, 0 if not

◆ setWaySpriteAnimationElement()

int setWaySpriteAnimationElement ( Element e,
int  code,
int  side 
)

set the way to go from a sprite to another (forward (1), backward (-1), no move (0))

Parameters
e: element
side: new way
Returns
0 if the way could be set, 1 if not

◆ setWidthElement()

int setWidthElement ( Element e,
double  width 
)

set the element's width

Parameters
e: element to be modified
width: new width
Returns
1 if there was an error, 0 if not