crisp-game-lib-arduboy
|
Functions | |
bool | colRect (Collision *cl, uint8_t color) |
Whether it's colliding with rects. More... | |
bool | colText (Collision *cl, char text) |
Whether it's colliding with texts. More... | |
bool | colCharacter (Collision *cl, char character) |
Whether it's colliding with characters. More... | |
Collision | rect (float x, float y, float w, float h) |
Draw a rectangle. Returns information on objects that collided while drawing. More... | |
Collision | box (float x, float y, float w, float h) |
Draw a box. Returns information on objects that collided while drawing. More... | |
Collision | line (float x1, float y1, float x2, float y2) |
Draw a line. Returns information on objects that collided while drawing. More... | |
Collision | bar (float x, float y, float length, float angle) |
Draw a bar. Returns information on objects that collided while drawing. More... | |
Collision | arc (float centerX, float centerY, float radius, float angleFrom, float angleTo) |
Draw a arc. Returns information on objects that collided while drawing. More... | |
Collision | text (char *msg, float x, float y) |
Draw a text. Returns information on objects that collided while drawing. More... | |
Collision | constText (const char *msg, float x, float y) |
Draw a const text. Returns information on objects that collided while drawing. More... | |
Collision | character (char character, float x, float y) |
void | play (uint8_t type) |
void | enableSound (void) |
Enable playing background music and sound effects. More... | |
void | disableSound (void) |
Disable playing background music and sound effects. More... | |
void | toggleSound (void) |
Toggle sound playing flag. More... | |
void | addScore (float value, float x, float y) |
void | particle (float x, float y, float count, float speed, float angle, float angleWidth) |
Add particles. More... | |
bool | btn (uint8_t button) |
Whether the button is being pressed. Button are INPUT_* . More... | |
bool | btnp (uint8_t button) |
Whether the button is just pressed now. Button are INPUT_* . More... | |
bool | btnr (uint8_t button) |
Whether the button is just released now. Button are INPUT_* . More... | |
float | rnd (float low, float high) |
Get a random float value of [low, high). More... | |
int16_t | rndi (int16_t low, int16_t high) |
Get a random int value of [low, high - 1]. More... | |
float | clamp (float v, float low, float high) |
Clamp a value to [low, high]. More... | |
float | wrap (float v, float low, float high) |
Wrap a value to [low, high). More... | |
void | gameOver (void) |
Transit to the game-over state. More... | |
void | setupGame (const char *_title, const char *_description, const CharacterData *_characters, const uint8_t **_sounds, void(*_update)(void)) |
Setup game. More... | |
void | initGame (void) |
Initialize game. More... | |
bool | updateGame (void) |
Update game frames if it's every 1/60 second timing. More... | |
Variables | |
uint16_t | ticks |
A variable incremented by one every 1/60 of a second (readonly). More... | |
float | score |
Game score. More... | |
float | difficulty |
int8_t | color |
float | thickness |
Set the thickness for drawing line() , bar() and arc() . More... | |
float | barCenterPosRatio |
bool | hasCollision |
void addScore | ( | float | value, |
float | x, | ||
float | y | ||
) |
Add score points and draw additional score on the screen. You can also add score points simply by adding the score
variable.
Collision arc | ( | float | centerX, |
float | centerY, | ||
float | radius, | ||
float | angleFrom, | ||
float | angleTo | ||
) |
Draw a arc. Returns information on objects that collided while drawing.
Collision bar | ( | float | x, |
float | y, | ||
float | length, | ||
float | angle | ||
) |
Draw a bar. Returns information on objects that collided while drawing.
Collision box | ( | float | x, |
float | y, | ||
float | w, | ||
float | h | ||
) |
Draw a box. Returns information on objects that collided while drawing.
bool btn | ( | uint8_t | button | ) |
Whether the button is being pressed. Button are INPUT_*
.
bool btnp | ( | uint8_t | button | ) |
Whether the button is just pressed now. Button are INPUT_*
.
bool btnr | ( | uint8_t | button | ) |
Whether the button is just released now. Button are INPUT_*
.
Collision character | ( | char | character, |
float | x, | ||
float | y | ||
) |
Draw a pixel art. Returns information on objects that collided while drawing. You can define pixel arts (6x6 dots) of characters with characters
array.
float clamp | ( | float | v, |
float | low, | ||
float | high | ||
) |
Clamp a value to [low, high].
bool colCharacter | ( | Collision * | cl, |
char | character | ||
) |
Whether it's colliding with characters.
bool colRect | ( | Collision * | cl, |
uint8_t | color | ||
) |
Whether it's colliding with rects.
bool colText | ( | Collision * | cl, |
char | text | ||
) |
Whether it's colliding with texts.
Collision constText | ( | const char * | msg, |
float | x, | ||
float | y | ||
) |
Draw a const text. Returns information on objects that collided while drawing.
void disableSound | ( | void | ) |
Disable playing background music and sound effects.
void enableSound | ( | void | ) |
Enable playing background music and sound effects.
void gameOver | ( | void | ) |
Transit to the game-over state.
void initGame | ( | void | ) |
Initialize game.
Collision line | ( | float | x1, |
float | y1, | ||
float | x2, | ||
float | y2 | ||
) |
Draw a line. Returns information on objects that collided while drawing.
void particle | ( | float | x, |
float | y, | ||
float | count, | ||
float | speed, | ||
float | angle, | ||
float | angleWidth | ||
) |
Add particles.
void play | ( | uint8_t | type | ) |
Play a sound effect. Type are COIN
, LASER
, EXPLOSION
, POWER_UP
, HIT
, JUMP
, SELECT
, CLICK
and RANDOM
.
Collision rect | ( | float | x, |
float | y, | ||
float | w, | ||
float | h | ||
) |
Draw a rectangle. Returns information on objects that collided while drawing.
float rnd | ( | float | low, |
float | high | ||
) |
Get a random float value of [low, high).
int16_t rndi | ( | int16_t | low, |
int16_t | high | ||
) |
Get a random int value of [low, high - 1].
void setupGame | ( | const char * | _title, |
const char * | _description, | ||
const CharacterData * | _characters, | ||
const uint8_t ** | _sounds, | ||
void(*)(void) | _update | ||
) |
Setup game.
Collision text | ( | char * | msg, |
float | x, | ||
float | y | ||
) |
Draw a text. Returns information on objects that collided while drawing.
void toggleSound | ( | void | ) |
Toggle sound playing flag.
bool updateGame | ( | void | ) |
Update game frames if it's every 1/60 second timing.
float wrap | ( | float | v, |
float | low, | ||
float | high | ||
) |
Wrap a value to [low, high).
float barCenterPosRatio |
A value from 0 to 1 that defines where the center coordinates are on the bar()
, default: 0.5.
int8_t color |
Set the color for drawing rectangles, particles, texts, and characters. Setting the color prior to text()
and character()
will recolor the pixel art. Use color = LIGHT1
to restore and use the original colors. Colors are DARK*
, LIGHT*
, INVERT*
and TRANSPARENT
.
float difficulty |
A variable that is one at the beginning of the game, two after 1 minute, and increasing by one every minute (readonly).
bool hasCollision |
If hasCollision
is set to true
, the drawn rectangle will have no collision with other rectangles. Used to improve performance.
float score |
Game score.
uint16_t ticks |
A variable incremented by one every 1/60 of a second (readonly).