Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Map/Map.cpp
- Committer:
- el17ttds
- Date:
- 2019-05-05
- Revision:
- 2:ee9b361ba6df
- Child:
- 3:3d35ab70b565
File content as of revision 2:ee9b361ba6df:
#include "Map.h" Map::Map() { } Map::~Map() { } void Map::init(int width,int height) { _w = width; _h = height; _x1 = -42 - (_w - 84) / 2; _x2 = 84 + (_w - 84) / 2; _y1 = -24 - (_h - 48) / 2; _y2 = 48 + (_h - 48) / 2; } void Map::write(int pix_x, int pix_y) { _x1 = _x1 - pix_x; _x2 = _x2 - pix_x; _y2 = _y2 + pix_y; _y2 = _y2 + pix_y; if (_x1 > 0) { _x1 = 0; } if (_x2 < 42) { _x2 = 42; } if (_y1 > 0) { _y1 = 0; } if (_y2 < 24) { _y1 = 24; } } void Map::draw(N5110 &lcd) { lcd.drawRect(_x1,_y1,_w,24,FILL_BLACK); lcd.drawRect(_x1,_y1,48,_h,FILL_BLACK); lcd.drawRect(_x1,_y2,_w,24,FILL_BLACK); lcd.drawRect(_x2,_y1,48,_h,FILL_BLACK); }