|
SANDAL2
A SDL2 Wrapper in C
|
Generic hitboxes either polygonial, elliptic or a mixe of both. More...
#include <math.h>#include <stdlib.h>

Go to the source code of this file.
Classes | |
| struct | Line |
| Represente a line which delimitate a hittable surface from a none hittable one. More... | |
| struct | Circle |
| Represente a hittable ellipse. More... | |
| struct | Clickable |
| Represente a hit boxe which is a collection of Line (defining a convexe polygon) and Circle. More... | |
| struct | ListClickable |
| Collection of hit boxes. More... | |
Typedefs | |
| typedef struct Line | Line |
| typedef struct Circle | Circle |
| typedef struct Clickable | Clickable |
Functions | |
| Clickable * | initClickable () |
| Generate an empty hitbox. More... | |
| int | addLine (Clickable *hb, double a, double b, double c, int side) |
| add a line to the hitbox side*(ax+by) > side*c More... | |
| int | addCircle (Clickable *hb, double x, double y, double rX, double rY, double theta) |
| add an ellipse to the hitbox More... | |
| int | delLine (Clickable *hb, double a, double b, double c, int side) |
| remove a line from the hitbox More... | |
| int | delCircle (Clickable *hb, double x, double y, double rX, double rY, double theta) |
| remove an ellipse from the hitbox More... | |
| int | hitClickable (Clickable *hb, double x, double y) |
| tells if (x,y) touch the hitbox More... | |
| Clickable * | rectangleClickable (double x1, double y1, double x2, double y2) |
| generate a rectangulare shapped Clickable More... | |
| Clickable * | ellipseClickable (double x, double y, double rX, double rY, double theta) |
| generate an ellipse shapped Clickable More... | |
| void | freeClickable (Clickable *hb) |
| free a hit boxe's memory More... | |
| void | freeListClickable (ListClickable *l) |
| free the memory of a list of hit boxe More... | |
| ListClickable * | initListClickable () |
| initialise an empty list of hit boxes More... | |
| int | addClickable (ListClickable *l, Clickable *hb, int blocking) |
| add a hit boxe to a list of hit boxes More... | |
| int | delClickable (ListClickable *l, Clickable *hb, int blocking) |
| remove a hit boxe to a list of hit boxes More... | |
| int | initIteratorListClickable (ListClickable *l) |
| initialise the iterator of the list of non blocking hit boxes More... | |
| Clickable * | nextClickable (ListClickable *l) |
| getter of the current non blocking element of the iterator and setter of the next element More... | |
| int | initIteratorListClickableBlocking (ListClickable *l) |
| initialise the iterator of the list of blocking hit boxes More... | |
| Clickable * | nextClickableBlocking (ListClickable *l) |
| getter of the current blocking element of the iterator and setter of the next element More... | |
| int | hitListClickable (ListClickable *l, double x, double y) |
| tells if (x,y) touch one of the hitboxes More... | |
Generic hitboxes either polygonial, elliptic or a mixe of both.
| int addCircle | ( | Clickable * | hb, |
| double | x, | ||
| double | y, | ||
| double | rX, | ||
| double | rY, | ||
| double | theta | ||
| ) |
add an ellipse to the hitbox
| hb | : hit boxe to which the line will be added |
| x | : abscissa coordinate of the center of the ellipse |
| y | : ordinate coordinate of the center of the ellipse |
| rX | : size of the radius parallel to the abscissa axis |
| rY | : size of the radius parallel to the ordinate axis |
| theta | : rotation of the ellipse (in degree) |
| int addClickable | ( | ListClickable * | l, |
| Clickable * | hb, | ||
| int | blocking | ||
| ) |
add a hit boxe to a list of hit boxes
| l | : list of hit boxes |
| hb | : hit boxe |
| int addLine | ( | Clickable * | hb, |
| double | a, | ||
| double | b, | ||
| double | c, | ||
| int | side | ||
| ) |
add a line to the hitbox side*(ax+by) > side*c
| hb | : hit boxe to which the line will be added |
| a | : a in the equation of the line ax+by=c |
| b | : b in the equation of the line ax+by=c |
| c | : c in the equation of the line ax+by=c |
| side | : indicator of the side of the line which is hittable (-1 : ax+by<c, 1 : ax+by>c) |
| int delCircle | ( | Clickable * | hb, |
| double | x, | ||
| double | y, | ||
| double | rX, | ||
| double | rY, | ||
| double | theta | ||
| ) |
remove an ellipse from the hitbox
| hb | : hit boxe to which the line will be removed |
| x | : abscissa coordinate of the center of the ellipse |
| y | : ordinate coordinate of the center of the ellipse |
| rX | : size of the radius parallel to the abscissa axis |
| rY | : size of the radius parallel to the ordinate axis |
| theta | : rotation of the ellipse (in degree) |
| int delClickable | ( | ListClickable * | l, |
| Clickable * | hb, | ||
| int | blocking | ||
| ) |
remove a hit boxe to a list of hit boxes
| l | : list of hit boxes |
| hb | : hit boxe |
| blocking | : 0 if the hit boxe is hittable, 1 if it block other hit boxes |
| int delLine | ( | Clickable * | hb, |
| double | a, | ||
| double | b, | ||
| double | c, | ||
| int | side | ||
| ) |
remove a line from the hitbox
| hb | : hit boxe to which the line will be removed |
| a | : a in the equation of the line ax+by=c |
| b | : b in the equation of the line ax+by=c |
| c | : c in the equation of the line ax+by=c |
| side | : indicator of the side of the line which is hittable (-1 : ax+by<c, 1 : ax+by>c) |
| Clickable* ellipseClickable | ( | double | x, |
| double | y, | ||
| double | rX, | ||
| double | rY, | ||
| double | theta | ||
| ) |
generate an ellipse shapped Clickable
| x | : abscissa coordinate of the center of the ellipse |
| y | : ordinate coordinate of the center of the ellipse |
| rX | : size of the radius parallel to the abscissa axis |
| rY | : size of the radius parallel to the ordinate axis |
| theta | : rotation of the ellipse (in degree) |
| void freeClickable | ( | Clickable * | hb | ) |
free a hit boxe's memory
| hb | : hit boxe to be freed |
| void freeListClickable | ( | ListClickable * | l | ) |
free the memory of a list of hit boxe
| l | : list of hit boxe to be freed |
| int hitClickable | ( | Clickable * | hb, |
| double | x, | ||
| double | y | ||
| ) |
tells if (x,y) touch the hitbox
| hb | : hit boxe that you are trying to touch |
| x | : abscissa coordinate of the point trying to touch the hit boxe |
| y | : ordinate coordinate of the point trying to touch the hit boxe |
| int hitListClickable | ( | ListClickable * | l, |
| double | x, | ||
| double | y | ||
| ) |
tells if (x,y) touch one of the hitboxes
| l | : list of hit boxes |
| x | : abscissa coordinate of the point trying to touch the hit boxe |
| y | : ordinate coordinate of the point trying to touch the hit boxe |
| Clickable* initClickable | ( | ) |
Generate an empty hitbox.
| int initIteratorListClickable | ( | ListClickable * | l | ) |
initialise the iterator of the list of non blocking hit boxes
| l | : list of hit boxes |
| int initIteratorListClickableBlocking | ( | ListClickable * | l | ) |
initialise the iterator of the list of blocking hit boxes
| l | : list of hit boxes |
| ListClickable* initListClickable | ( | ) |
initialise an empty list of hit boxes
| Clickable* nextClickable | ( | ListClickable * | l | ) |
getter of the current non blocking element of the iterator and setter of the next element
| Clickable* nextClickableBlocking | ( | ListClickable * | l | ) |
getter of the current blocking element of the iterator and setter of the next element
| Clickable* rectangleClickable | ( | double | x1, |
| double | y1, | ||
| double | x2, | ||
| double | y2 | ||
| ) |
generate a rectangulare shapped Clickable
| x1 | : abscissa coordinate of the top left point of the rectangle |
| y1 | : ordinate coordinate of the top left point of the rectangle |
| x2 | : abscissa coordinate of the bottom right point of the rectangle |
| y2 | : ordinate coordinate of the bottom right point of the rectangle |
1.8.13