Initial publish

Dependencies:   mbed

Fork of el17dg by Dmitrijs Griskovs

main/main.h

Committer:
Noximilien
Date:
2019-04-15
Revision:
29:579e00b7f118
Parent:
28:35af3843de8f
Child:
31:becb8f6bf7b7

File content as of revision 29:579e00b7f118:

#ifndef MAIN_H
#define MAIN_H

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "geometry.h"
#include "models.h"

/** Global variable readings from the gamepad are shared for all the files to
 * use.
 */
extern N5110 lcd;
extern Gamepad gamepad;
extern AnalogIn pot;
extern AnalogIn x_dir;
extern AnalogIn y_dir;

static const int fps = 10;

/** @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