1 #ifndef ELEMENTSDL2_SANDAL2_KLEVH 2 #define ELEMENTSDL2_SANDAL2_KLEVH 11 #define SANDAL2_FLIP_HOR SDL_FLIP_HORIZONTAL 12 #define SANDAL2_FLIP_VER SDL_FLIP_VERTICAL 13 #define SANDAL2_FLIP_NONE SDL_FLIP_NONE 14 #define SANDAL2_FLIP SDL_RendererFlip 88 void (*keyPress)(
struct Element*,SDL_Keycode c);
90 void (*keyReleased)(
struct Element*,SDL_Keycode c);
94 void (*endSprite)(
struct Element*,
int code);
147 void (*freeData)(
void*);
246 Element*
createBlock(
double x,
double y,
double width,
double height,
int color[4],
int displayCode,
int plan);
260 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);
271 Element*
createImage(
double x,
double y,
double width,
double height,
const char *image,
int displayCode,
int plan);
298 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);
314 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);
333 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);
352 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);
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.
Definition: Element.c:647
int getTextElement(Element *e, char **s)
get the text of an element
Definition: Element.c:912
int setTextStyleElement(Element *e, int style)
set the element's text font style
Definition: Element.c:1059
Information about TTF objects.
int setAlphaElement(Element *e, int alpha)
set alpha of the element (255: completly visible, 0: completly transparent)
Definition: Element.c:1986
int setSpriteAnimationElement(Element *e, int codeS)
set the sprite in the current animation of an element
Definition: Element.c:1895
int initIteratorElement(Element *e)
initialize the element's iterator on all the elements it can modifie
Definition: Element.c:2106
int clearPlanDisplayCode(int code, int plan)
clear all elements of a plan in a display code of the current window
Definition: Element.c:1415
int freeDataElement(Element *e)
free the element's data according to the element's freeing data behavior
Definition: Element.c:1757
int getDimensionElement(Element *e, double *w, double *h)
getter for the Element's dimensions
Definition: Element.c:844
int previousSpriteElement(Element *e)
go to the previous sprite of the current animation of an element
Definition: Element.c:1831
List (display code) of list (plan) of element.
Definition: Element.h:169
int setImageSurfaceElement(Element *e, SDL_Surface *image)
set the element's image with a 's texture
Definition: Element.c:1131
int moveElement(Element *e, double x, double y)
move an element
Definition: Element.c:1175
Contains display code and list of display codes.
int setScriptedEntry(Element *e, int isScripted)
set an element to crypted or uncrypted
Definition: Element.c:2219
int setUnClickElement(Element *e, void(*unCLick)(Element *, int button))
set the behaviour of an element when it is unclicked
PtrElement * current
Definition: Element.h:69
Display code containing the plan and a flag to indicate if it is displaied.
Definition: DisplayCode.h:21
int getAlphaElement(Element *e, int *alpha)
get the element's color alpha value (from 0 for transparent to 255 for fully visible) ...
Definition: Element.c:992
int setHeightElement(Element *e, double height)
set the element's height
Definition: Element.c:1943
int addSpriteAnimationElement(Element *e, int code, int x, int y, int width, int height, int lifespan, int codeS)
add a Sprite to the element
Definition: Element.c:1789
int setEndActionElement(Element *e, void(*endAction)(Element *))
set the behaviour of an element when its action list ends
Definition: Element.c:1544
int code
Definition: Element.h:73
List of list (display code) of list (plan) of elements.
Definition: Element.h:184
Contains all structures related to actions on element.
int setAngleElement(Element *e, double a)
set the angle of an element
Definition: Element.c:1713
int setUnSelectElement(Element *e, void(*unSelect)(Element *))
set the behaiour of an element when it is unselect
Definition: Element.c:1522
double textSize
Definition: Element.h:127
Collection of hit boxes.
Definition: Clickable.h:70
int deleted
Definition: Element.h:149
int setLifeSpanSpriteAnimationElement(Element *e, int code, int codeS, unsigned lifespan)
set the lifespan of a sprite
Definition: Element.c:1809
int getWidthElement(Element *e, double *w)
get the element's width
Definition: Element.c:948
int getCoordYElement(Element *e, double *y)
get the element's y coordinate
Definition: Element.c:981
int setParentElement(Element *parent, Element *child)
set the parent of an element in the scenary graph
Definition: Element.c:2033
struct ListPtrElement * next
Definition: Element.h:71
int setDisplayCodeElement(Element *e, int displayCode, int isDisplaied)
set the isDisplaied option of a display code (if the element has it)
Definition: Element.c:1321
struct PtrElement * next
Definition: Element.h:54
Represente a hit boxe which is a collection of Line (defining a convexe polygon) and Circle...
Definition: Clickable.h:57
ListWindow * _windows_SANDAL2
List of windows WARNING : Do not touch this list ... trust me.
Definition: Window.c:3
Element * nextIteratorElement(Element *e)
gives the current element's iterator's value and go to the next one
Definition: Element.c:2117
int setCoordXElement(Element *e, double x)
set the element's x coordinate
Definition: Element.c:1952
ListPtrElement * currentPIterator
Definition: Element.h:189
int setImageElement(Element *e, const char *image)
set the element's image
Definition: Element.c:1101
int isDisplaiedElement(Element *e)
tell whether or not the element can be displaied
Definition: Element.c:763
int rotateElement(Element *e, double a, double prX, double prY)
directly rotate the element (more time consuming than adding angle)
Definition: Element.c:1665
int setKeyPressedElement(Element *e, void(*keyPress)(Element *, SDL_Keycode c))
set the behaviour of an element when a key is pressed
Definition: Element.c:1456
List of display codes.
Definition: DisplayCode.h:36
int setFreeDataElement(Element *e, void(*freeData)(void *))
set the element's freeing data's function (by default, set to free)
Definition: Element.c:1746
SANDAL2 window.
Definition: Window.h:70
int selected
Definition: Element.h:153
int size
Definition: Element.h:37
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) ...
Definition: Element.c:2193
struct Element * element
Definition: Element.h:52
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.
Definition: Element.c:461
int getColorElement(Element *e, int color[4])
get the element's block color
Definition: Element.c:937
int setTextSize(Element *e, double textSize)
set the text size of the text of an element in this element
Definition: Element.c:1203
Element * nextElement()
gives the current iterator's value and go to the next one
Definition: Element.c:2164
EventElement events
Definition: Element.h:131
Element * createImage(double x, double y, double width, double height, const char *image, int displayCode, int plan)
Generate an image like element.
Definition: Element.c:520
int delActionToElement(Element *e, long long index)
remove an action of the element action list
Definition: Element.c:2023
int size_max
Definition: Element.h:35
int setOnClickElement(Element *e, void(*onCLick)(Element *, int button))
set the behaviour of an element when it is clicked
int previousAnimationElement(Element *e)
go to the previous animation of an element
Definition: Element.c:1874
long long addActionToElement(Element *e, ListAction *action)
add an action at the end of the element action list
Definition: Element.c:2008
int addElementToElement(Element *e, Element *add)
add an element to another so that this other can modifie the first one
Definition: Element.c:1555
int setTextColorElement(Element *e, int color[4])
set the element's text color
Definition: Element.c:1080
int delElement(Element *e)
mark an element as removable
Definition: Element.c:356
int getAngleElement(Element *e, double *a)
getter for the Element's angle
Definition: Element.c:831
All the informations of an element.
Definition: Element.h:108
int replaceElement(Element *e, double x, double y)
set the element's coordinates
Definition: Element.c:1160
void _cleanElement(void)
remove all elements that are marked as deletable (do not use it yourself, used in update) ...
Definition: Element.c:251
int setDataElement(Element *e, void *data)
set the element's data
Definition: Element.c:1735
double prY
Definition: Element.h:119
int getCoordElement(Element *e, double *x, double *y)
getter for the Element's coordinates
Definition: Element.c:815
int setKeyReleasedElement(Element *e, void(*keyReleased)(Element *, SDL_Keycode c))
set the behaviour of an element when a key is released
Definition: Element.c:1467
double x
Definition: Element.h:109
ListPtrElement * current
Definition: Element.h:172
Structure used to store elements' pointers in a list of element.
Definition: Element.h:51
Sprite manager for SANDAL2.
Window * parent
Definition: Element.h:155
int addDisplayCodeElement(Element *e, int displayCode, int plan)
add a display code to an element (if it did not already had it)
Definition: Element.c:1214
int initIterator(int displayCode)
initialise the iterator of all elements having a common display code
Definition: Element.c:2134
int size_min
Definition: Element.h:33
Informations about font.
Definition: Font.h:44
int delAnimationElement(Element *e, int code)
remove an empty animation from the list
Definition: Element.c:1779
int setActionListElement(Element *e, ListAction *actions)
Define a list of actions to apply to an element.
Definition: Element.c:1970
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)) ...
Definition: Element.c:1843
int clearWindow(void)
remove all elements from the current window
Definition: Element.c:1905
int nextSpriteElement(Element *e)
go to te next sprite of the current animation of an element
Definition: Element.c:1819
int setAnimationElement(Element *e, int code)
set the animation of an element
Definition: Element.c:1885
int setOnMouseMotionElement(Element *e, void(*onMouseMotion)(Element *))
set the behaviour of an element when the mouse move on it
Definition: Element.c:1500
int setFlipStateElement(Element *e, SANDAL2_FLIP flip)
set the flip state of an element
Definition: Element.c:1927
int getFlipStateElement(Element *e, SANDAL2_FLIP *flip)
get the flip state of an element
Definition: Element.c:808
int setActionElement(Element *e, void(*action)(Element *))
set the continuous behaviour of an element
Definition: Element.c:1445
int delDisplayCodeElement(Element *e, int displayCode)
remove a display code to an element (if it has it)
Definition: Element.c:1277
int setUnMouseMotionElement(Element *e, void(*unMouseMotion)(Element *))
set the behaviour of an element when the mouse move out of it
Definition: Element.c:1511
int delParentElement(Element *child)
Remove the parent of an element in the scenary graph.
Definition: Element.c:2071
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.
Definition: Element.c:669
int setEndSpriteElement(Element *e, void(*endSprite)(Element *, int currentCode))
set the behaviour of an element when it ends a sprite
SDL_Texture * image
Definition: Element.h:133
Font * font
Definition: Element.h:137
int clearDisplayCode(int code)
clear all elements of a display code in the current window
Definition: Element.c:778
Behaviors of an element to events.
Definition: Element.h:81
ListAction * actions
Definition: Element.h:157
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.
Definition: Element.c:716
int setTextElement(Element *e, const char *text)
set the element's text
Definition: Element.c:1032
int setRotationPointElement(Element *e, double x, double y)
set the rotation point's coordinates of an element
Definition: Element.c:1723
ListDCElement * currentDCIterator
Definition: Element.h:187
double prX
Definition: Element.h:117
int deleted
Definition: Element.h:56
Element * createBlock(double x, double y, double width, double height, int color[4], int displayCode, int plan)
Generate a non rotable rectangle like element.
Definition: Element.c:409
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.
Definition: Element.c:625
struct ListDCElement * next
Definition: Element.h:174
int setTextQualityElement(Element *e, int quality)
set the element's text color
Definition: Element.c:1090
void * data
Definition: Element.h:145
ListClickable * hitboxes
Definition: Element.h:143
int getDataElement(Element *e, void **data)
getter for the element's data
Definition: Element.c:876
double y
Definition: Element.h:111
Entry * entry
Definition: Element.h:139
Generic hitboxes either polygonial, elliptic or a mixe of both.
int clearElementToElement(Element *e)
remove all elements binded to an element
Definition: Element.c:1620
int addAngleElement(Element *e, double a)
increase the angle of an element
Definition: Element.c:1650
struct Element * elementParent
Definition: Element.h:159
int isScripted
Definition: Element.h:41
PtrElement * last
Definition: Element.h:67
int nextAnimationElement(Element *e)
go to te next animation of an element
Definition: Element.c:1863
int addClickableElement(Element *e, Clickable *hb, int blocking)
add a clickable zone to the element (or a blocking one)
Definition: Element.c:1640
int delSpriteAnimationElement(Element *e, int code, int codeS)
remove a Sprite in the element
Definition: Element.c:1799
double height
Definition: Element.h:115
int deleteCode
Definition: Element.h:151
int code
Definition: Element.h:176
int setColorElement(Element *e, int color[4])
set the element's block color
Definition: Element.c:1069
int getCoordXElement(Element *e, double *x)
get the element's x coordinate
Definition: Element.c:970
int isSelect
Definition: Element.h:39
int setCoordYElement(Element *e, double y)
set the element's y coordinate
Definition: Element.c:1961
double width
Definition: Element.h:113
int addCharEntry(Element *e, char c)
add a character to a prompt
Definition: Element.c:2230
struct ListPtrElement * interactions
Definition: Element.h:141
int getTextStyleElement(Element *e, int *style)
Definition: Element.c:902
int addAnimationElement(Element *e, int code)
add an empty animation to the element
Definition: Element.c:1769
int getRotationPointElement(Element *e, double *x, double *y)
getter for the Element's rotation point
Definition: Element.c:860
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())
Definition: Element.c:583
a list of animations
Definition: Sprite.h:60
double rotation
Definition: Element.h:121
ListAnimation * animation
Definition: Element.h:135
void _freeListElement(ListElement *l)
free the memory of a list of lists (display code) of lists (plan) of elements
Definition: Element.c:187
int delElementToElement(Element *e, Element *del)
remove an element to another so that this other can not modifie the first one
Definition: Element.c:1587
Contains all structures related to windows but only those unrelated to Elements.
int setFontElement(Element *e, const char *font)
set the element's font
Definition: Element.c:1009
void _freeElement(Element *e)
Free the memory used by an element.
Definition: Element.c:374
int addElement(Element *e)
add an element to a list of lists (display code) of lists (plan) of elements
Definition: Element.c:201
List of PtrElement.
Definition: Element.h:64
int setDimensionElement(Element *e, double width, double height)
resize an element
Definition: Element.c:1190
int isSelectedElement(Element *e, int *select)
tells whether or not the element is selected
Definition: Element.c:889
list of windows
Definition: Window.h:128
int setPlanElement(Element *e, int DisplayCode, int plan)
set the plan of a display code (if the element has it)
Definition: Element.c:1339
ListElement * _initListElement(void)
Initialise a list of lists (display code) of lists (plan) of elements.
Definition: Element.c:175
ListDisplayCode * codes
Definition: Element.h:129
More informations about entry.
Definition: Element.h:32
PtrElement * first
Definition: Element.h:65
int delCharEntry(Element *e)
remove a character to a prompt
Definition: Element.c:2243
int setWidthElement(Element *e, double width)
set the element's width
Definition: Element.c:1934
ListDCElement * first
Definition: Element.h:185
int getHeightElement(Element *e, double *h)
get the element's height
Definition: Element.c:959
ListPtrElement * first
Definition: Element.h:170