test 1 doc

Dependencies:   mbed Gamepad2

Platform/Platform.cpp

Committer:
joebarhouch
Date:
2020-05-25
Revision:
6:00d20886e4f8
Parent:
5:928c2eee4109
Child:
7:530ca713d2b2

File content as of revision 6:00d20886e4f8:

#include "Platform.h"

Platform::Platform(int x, int y, int w, int h)
{
    _x = x;
    _y = y;
    _width = w;
    _height = h;
}

Platform::~Platform()
{

}


////////////////////// DRAW  //////////////////////////
void Platform::draws(N5110 &lcd)
{
    lcd.drawRect(_x, _y, _width, _height, FILL_TRANSPARENT);
    //debug prints
    //printf("x: %i, y: %i, width: %i, height %i \n", x, y, width, height);
}

////////////////////// POSTITIONS //////////////////////////
Vector4 Platform::get_pos()
{
    Vector4 pos = {_x, _y, _width, _height};
    return pos;
}



//------------------------------MAPS-----------------------------------//

Platform maps[4] = {Platform(0, 15, 20, 3), Platform(64, 15, 20, 3), Platform(0, 40, 20, 3), Platform(64, 40, 20, 3)};

////////////////////// DRAW MAP //////////////////////////
void drawMap(N5110 &lcd)
{
    Vector4 coords;
    for (int i = 0; i < 4; i++) {
        maps[i].draws(lcd);
        coords = maps[i].get_pos();
        
        //debugs
        //printf("x: %i, y: %i,w: %i,h: %i \n",coords.x, coords.y, coords.width, coords.height);
    }
        //debugs
        //printf("-----------------------------------------\n");
}