Initial publish

Dependencies:   mbed

Fork of el17dg by Dmitrijs Griskovs

main/main.h

Committer:
Noximilien
Date:
2019-04-10
Revision:
28:35af3843de8f
Parent:
27:f05f4e738ba9
Child:
29:579e00b7f118

File content as of revision 28:35af3843de8f:

#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;

/** 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);
}

/** 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 SpriteOnTop& spriteOnTop) {
    lcd.drawSpriteOnTop(pos.x, pos.y, spriteOnTop.height, spriteOnTop.width, (int*)spriteOnTop.data);
}

#endif