Map

Map.cpp

Committer:
JackCripps
Date:
2017-04-25
Revision:
0:1d3957b7699a
Child:
1:afa730298a2b

File content as of revision 0:1d3957b7699a:

#include "Map.h"

Map::Map()
:
_tileImageBitmap(tileImage, 4, 4),
_cols(21),
_rows(12)
    
{}

Map::~Map()
{
     
}

void Map::draw(N5110& lcd)
{
    for (int c = 0; c < _cols; c++)
    {
        for (int r = 0; r < _rows; r++)
        {
            if (this->getTile(c, r) != 0)
            {
                _tileImageBitmap.render(lcd, c * tileSize, r * tileSize);
            }
        }
    }
}

int Map::getTile(int col, int row)
{
    return tileMap[row * _cols + col];
}