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.
Engine/Engine.cpp
- Committer:
- Andrew_M
- Date:
- 2018-04-29
- Revision:
- 4:6353f829c56c
- Parent:
- 3:6253a2d374fa
- Child:
- 5:a3a9e0417e04
File content as of revision 4:6353f829c56c:
#include "Engine.h" Engine::Engine() { } Engine::~Engine() { } void Engine::init() // initialise the game parameters { memset(_grid, 0, sizeof(_grid)); _solid.init(3,5); } void Engine::read_input(Gamepad &pad) { _d = pad.get_direction(); } void Engine::draw(N5110 &lcd) { lcd.drawRect(0,0,48,48,FILL_TRANSPARENT); for (int j = 0; j < 22; j++) { for (int i = 0; i < 22; i++) { if (_grid[i][j] != 0) { lcd.drawRect((2 * i) + 2,(2 * j) + 2,2,2,FILL_BLACK); } } } } void Engine::update(Gamepad &pad) { memset(_grid, 0, sizeof(_grid)); _solid.update(_d); int _l =_solid.getLength(); for (int i = _l; i >= 1; i--) { _grid[_solid.getX(i)][_solid.getY(i)] = 1; } }