Initial publish
Dependencies: mbed
Fork of el17dg by
Diff: game/gameobject.h
- Revision:
- 33:c623c6d5ed16
- Parent:
- 31:becb8f6bf7b7
--- a/game/gameobject.h Fri Apr 26 13:09:03 2019 +0000 +++ b/game/gameobject.h Mon Apr 29 08:10:52 2019 +0000 @@ -1,7 +1,7 @@ #ifndef GAMEOBJECT_H #define GAMEOBJECT_H -#include "geometry.h" +#include "collision_lib.h" ///////////////////////////////////////////////////////////////////// /** @@ -23,4 +23,25 @@ Point pos; bool active; }; + +/** + * @brief A simplified function to draw sprites. + * @details This is a specific function I made to simplify drawing the sprites. + * It only works with spawn() function in gameobject.h. + * The parameters for this function are given in the models.cpp for the + * sprites. + */ +static void drawSprite(Point pos, const Sprite& sprite) { + lcd.drawSprite(pos.x, pos.y, sprite.height, sprite.width, (int*)sprite.data); +} + +/** + * @brief A simplified function to draw sprites. But this draw black pixels on top of white pixels. + * @details This is an exactly the same function as before, but for the drawing + * sprite function that draws the black pixels on top the white pixels when the + * sprites overlap. + */ +static void drawSpriteOnTop(Point pos, const Sprite& sprite) { + lcd.drawSpriteOnTop(pos.x, pos.y, sprite.height, sprite.width, (int*)sprite.data); +} #endif \ No newline at end of file