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.
Diff: Engine/Engine.cpp
- Revision:
- 2:9ca5e1c221c3
- Parent:
- 1:a14415de3ad5
- Child:
- 3:6253a2d374fa
--- a/Engine/Engine.cpp Mon Apr 16 09:07:17 2018 +0000 +++ b/Engine/Engine.cpp Mon Apr 16 10:55:00 2018 +0000 @@ -10,9 +10,11 @@ } -void Engine::init() +void Engine::init() // initialise the game parameters { - // initialise the game parameters + memset(_grid, 0, sizeof(_grid)); + + _solid.init(3,5); } void Engine::read_input(Gamepad &pad) @@ -23,10 +25,23 @@ 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 + 1,2 * j + 1,2,2,FILL_BLACK); + } + } + } } void Engine::update(Gamepad &pad) { - + memset(_grid, 0, sizeof(_grid)); + + //_grid[3][5] = 1; + + int tempX = _solid.getX(); + int tempY = _solid.getY(); + _grid[tempX][tempY] = 1; }