![]() |
SANDAL2
A SDL2 Wrapper in C
|
Contains all structures related to windows but only those unrelated to Elements. More...
#include <string.h>
#include <stdlib.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
#include <SDL2/SDL_image.h>
Go to the source code of this file.
Classes | |
struct | EventWindow |
Behaviors of a window to events. More... | |
struct | Window |
SANDAL2 window. More... | |
struct | ListWindow |
list of windows More... | |
Macros | |
#define | absolu(a) ((a>0)?a:-a) |
Get the absolute value of a variable. | |
#define | PFREE(p) |
free p if it is not NULL More... | |
Typedefs | |
typedef struct Window | Window |
Functions | |
int | resizeWindow (unsigned width, unsigned height) |
Resize the current window. More... | |
int | setDisplayCodeWindow (int displayCode) |
Change the display code of the current window. More... | |
Uint32 | initIteratorWindow () |
Initialise the iterator of the windows' list. More... | |
Uint32 | nextWindow () |
Go to the next window. More... | |
int | getDimensionWindow (int *w, int *h) |
Put the width of the current window in w (if not NULL) and its height in h (if not NULL) More... | |
int | getDisplayCodeWindow (int *d) |
Put the display code of the current window in d (if not NULL) More... | |
int | getColorWindow (int color[4]) |
Put the background color of the current window in color. More... | |
int | setColorWindow (const int color[4]) |
Change the background color of the current window. More... | |
int | getCoordWindow (int *x, int *y) |
Getter for the current window position. More... | |
int | setCoordWindow (int x, int y) |
Set for the current window position. More... | |
int | getRealDimensionWindow (int *width, int *height) |
Getter for the real dimension of the current window (do not use this function to calculate elements' size or coordinates, use getDimensionWindow instead) More... | |
int | getIDWindow (Uint32 *ID) |
Getter for the currently displaied window ID. More... | |
int | getIDCurrentWindow (Uint32 *ID) |
Getter for the current window ID. More... | |
int | setIconWindow (const char *icon_path) |
Set the current window's icon. More... | |
int | setActionWindow (void(*action)(void)) |
set the continuous behaviour of the current window More... | |
int | setKeyPressedWindow (void(*keyPress)(SDL_Keycode c)) |
set the behaviour of the current window when a key is pressed More... | |
int | setKeyReleasedWindow (void(*keyReleased)(SDL_Keycode c)) |
set the behaviour of the current window when a key is released More... | |
int | setOnClickWindow (void(*onCLick)(int)) |
set the behaviour of the current window when it is clicked More... | |
int | setUnClickWindow (void(*unCLick)(int)) |
set the behaviour of the current window when it is unclicked More... | |
int | setOnWheelWindow (void(*onWheel)(int)) |
set behavior of window when a wheel event occure More... | |
int | setOnMouseMotionWindow (void(*onMouseMotion)(int, int)) |
set behavior of window when a wheel event occure More... | |
int | setOnFocusedWindow (void(*onFocus)(void)) |
set behavior of window when the window gain focus More... | |
int | setUnFocusedWindow (void(*unFocus)(void)) |
set behavior of window when the window lose focus More... | |
int | getOriginWindow (int *x, int *y) |
get the origin point of the current window More... | |
int | setOriginWindow (int x, int y) |
set the origin point of the current window More... | |
int | setXOriginWindow (int x) |
set the x coordinate of the origin point of the current window More... | |
int | setYOriginWindow (int y) |
set the y coordinate of the origin point of the current window More... | |
int | setDataWindow (void *data) |
set the data package of a window More... | |
int | getDataWindow (void **data) |
get the data package of a window More... | |
int | setDisplayWindow (Uint32 windowID) |
set the window to be displaied and the current window More... | |
Variables | |
ListWindow * | _windows_SANDAL2 |
list of windows WARNING : do not touch this variable, never ... trust me More... | |
Contains all structures related to windows but only those unrelated to Elements.
#define PFREE | ( | p | ) |
free p if it is not NULL
int getColorWindow | ( | int | color[4] | ) |
Put the background color of the current window in color.
color | : where the background color of the current window should be store |
int getCoordWindow | ( | int * | x, |
int * | y | ||
) |
Getter for the current window position.
x | : where the abscissa coordinate of the window will be store |
y | : where the ordinate coordinate of the window will be store |
int getDataWindow | ( | void ** | data | ) |
get the data package of a window
data | : where to store the package of the window |
int getDimensionWindow | ( | int * | w, |
int * | h | ||
) |
Put the width of the current window in w (if not NULL) and its height in h (if not NULL)
w | : where the width of the current window should be store |
h | : where the height of the current window should be store |
int getDisplayCodeWindow | ( | int * | d | ) |
Put the display code of the current window in d (if not NULL)
d | : where the display code of the current window should be store |
int getIDCurrentWindow | ( | Uint32 * | ID | ) |
Getter for the current window ID.
ID | : where to store the ID |
int getIDWindow | ( | Uint32 * | ID | ) |
Getter for the currently displaied window ID.
ID | : where to store the ID |
int getOriginWindow | ( | int * | x, |
int * | y | ||
) |
get the origin point of the current window
x | : where to store the x coordinate |
y | : where to store the y coordinate |
int getRealDimensionWindow | ( | int * | width, |
int * | height | ||
) |
Getter for the real dimension of the current window (do not use this function to calculate elements' size or coordinates, use getDimensionWindow instead)
width | : where the real width of the window will be store |
height | : where the real height of the window will be store |
Uint32 initIteratorWindow | ( | ) |
Initialise the iterator of the windows' list.
Uint32 nextWindow | ( | ) |
Go to the next window.
int resizeWindow | ( | unsigned | width, |
unsigned | height | ||
) |
Resize the current window.
width | : new width of the current window |
height | : new height of the current window |
int setActionWindow | ( | void(*)(void) | action | ) |
set the continuous behaviour of the current window
action | : function to be called on each update call |
int setColorWindow | ( | const int | color[4] | ) |
Change the background color of the current window.
color | : new color of the background of the current window |
int setCoordWindow | ( | int | x, |
int | y | ||
) |
Set for the current window position.
x | : new abscissa coordinate of the window |
y | : new ordinate coordinate of the window |
int setDataWindow | ( | void * | data | ) |
set the data package of a window
data | : new package of the window |
int setDisplayCodeWindow | ( | int | displayCode | ) |
Change the display code of the current window.
displayCode | : new display code of the current window |
int setDisplayWindow | ( | Uint32 | windowID | ) |
set the window to be displaied and the current window
windowID | : ID of the window to be displaied and to become current |
int setIconWindow | ( | const char * | icon_path | ) |
Set the current window's icon.
icon_path | : path of the image to be used |
int setKeyPressedWindow | ( | void(*)(SDL_Keycode c) | keyPress | ) |
set the behaviour of the current window when a key is pressed
keyPress | : function to be called when a key is pressed |
int setKeyReleasedWindow | ( | void(*)(SDL_Keycode c) | keyReleased | ) |
set the behaviour of the current window when a key is released
keyReleased | : function to be called when a key is released |
int setOnClickWindow | ( | void(*)(int) | onCLick | ) |
set the behaviour of the current window when it is clicked
onCLick | : function to be called when it is clicked |
int setOnFocusedWindow | ( | void(*)(void) | onFocus | ) |
set behavior of window when the window gain focus
onFocus | : function to be called |
int setOnMouseMotionWindow | ( | void(*)(int, int) | onMouseMotion | ) |
set behavior of window when a wheel event occure
wheel | : function to be called |
int setOnWheelWindow | ( | void(*)(int) | onWheel | ) |
set behavior of window when a wheel event occure
onWheel | : function to be called when a wheel event occure |
int setOriginWindow | ( | int | x, |
int | y | ||
) |
set the origin point of the current window
x | : new x coordinate |
y | : new y coordinate |
int setUnClickWindow | ( | void(*)(int) | unCLick | ) |
set the behaviour of the current window when it is unclicked
unCLick | : function to be called when it is unclicked |
int setUnFocusedWindow | ( | void(*)(void) | unFocus | ) |
set behavior of window when the window lose focus
unFocus | : function to be called |
int setXOriginWindow | ( | int | x | ) |
set the x coordinate of the origin point of the current window
x | : new x coordinate |
int setYOriginWindow | ( | int | y | ) |
set the y coordinate of the origin point of the current window
y | : new y coordinate |
ListWindow* _windows_SANDAL2 |
list of windows WARNING : do not touch this variable, never ... trust me
list of windows WARNING : do not touch this variable, never ... trust me
List of the windows WARNING : do not touch it ... trust me.