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.
Dependencies: mbed
Diff: GraphicEngine/GraphicEngine.cpp
- Revision:
- 17:67dbdfcdcec2
- Parent:
- 16:8a65cccd9685
- Child:
- 18:6be4c3c94a3d
--- a/GraphicEngine/GraphicEngine.cpp Wed May 13 23:07:05 2020 +0000 +++ b/GraphicEngine/GraphicEngine.cpp Thu May 14 01:07:27 2020 +0000 @@ -85,6 +85,44 @@ displayCar(temp_car); } +void GraphicEngine::showWater(Water *water) +{ + for(int i = 0; i < 22; i++) + { + showIndividualWater(&water[i]); + } +} + +void GraphicEngine::showIndividualWater(Water *water) +{ + // POTENTIAL BUG, add break later + switch(water->sprite){ + case 'F': + displayFirstWater(water); + case 'S': + displaySecondWater(water); + case 'T': + displayThirdWater(water); + } +} + +// x is the offset in the for loop, y is the row number +void GraphicEngine::displayFirstWater(Water &waterobj) +{ + lcd.drawSprite(waterobj.x,48 - 4*waterobj.y, 4, 4, (int *)first_water); +} + +// x is the offset in the for loop, y is the row number +void GraphicEngine::displaySecondWater(Water &waterobj) +{ + lcd.drawSprite(waterobj.x,48 - 4*waterobj.y, 4, 4, (int *)second_water); +} + +// x is the offset in the for loop, y is the row number +void GraphicEngine::displayThirdWater(Water &waterobj) +{ + lcd.drawSprite(waterobj.x,48 - 4*waterobj.y, 4, 4, (int *)third_water); +} void GraphicEngine::drawVehicleSprites(char obj, int x, int y, int rows, int cols) {