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:
- 50:9ffeb4a10c0a
- Parent:
- 49:6cad8b6ec5f2
- Child:
- 51:4c1f49729d88
diff -r 6cad8b6ec5f2 -r 9ffeb4a10c0a GraphicEngine/GraphicEngine.cpp
--- a/GraphicEngine/GraphicEngine.cpp Sun May 24 02:30:49 2020 +0000
+++ b/GraphicEngine/GraphicEngine.cpp Mon May 25 02:18:57 2020 +0000
@@ -1,11 +1,122 @@
#include "GraphicEngine.h"
-//GraphicEngine::GraphicEngine(){}
-GraphicEngine::GraphicEngine(){
- //this->frog = frogptr;
+GraphicEngine::GraphicEngine(){}
+
+void GraphicEngine::getPointerPos(int sel)
+{
+ switch(sel)
+ {
+ case 0:
+ lcd.drawSprite(30, 48 - 4*12, 8, 12, (int *)frog);
+ break;
+ case 1:
+ lcd.drawSprite(55, 44 - 4*7, 8, 12, (int *)frog);
+ break;
+ case 2:
+ lcd.drawSprite(50, 48 - 4*4, 8, 12, (int *)frog);
+ break;
+ }
+
+ wait_ms(10);
+}
+void GraphicEngine::drawMenu()
+{
+ lcd.printString("Play",3, 0);
+ lcd.drawRect(-1, 48 - 4*12, 30, 11, FILL_TRANSPARENT);
+
+ lcd.printString("Tutorial",3,2);
+ lcd.drawRect(-1, 50 - 4*9, 55, 10, FILL_TRANSPARENT);
+
+ lcd.printString("Setting",3,4);
+ lcd.drawRect(-1, 50 - 4*5, 50, 10, FILL_TRANSPARENT);
+}
+
+void GraphicEngine::drawTutor1()
+{
+ lcd.printString("Tutorial: (A) ", 0,0);
+ lcd.printString("To move frog ", 0,1);
+ lcd.printString("press X(UP), ", 0,2);
+ lcd.printString("B(DOWN) ", 0,3);
+ lcd.printString("A(LEFT), ", 0,4);
+ lcd.printString("Y(right) ", 0,5);
+ wait_ms(20);
+}
+
+void GraphicEngine::drawTutor2()
+{
+ lcd.printString("Tutorial: (A) ", 0,0);
+ lcd.printString("Avoid, water, ", 0,1);
+ lcd.printString("vehicles, ", 0,2);
+ lcd.printString("snakes ", 0,3);
+ lcd.printString("jump on logs, ", 0,4);
+ lcd.printString("reach the goal", 0,5);
+ wait_ms(20);
}
+void GraphicEngine::drawTutor3()
+{
+ lcd.printString("Tutorial: (A) ", 0,0);
+ lcd.printString("Most ", 0,1);
+ lcd.printString("importantly ", 0,2);
+ lcd.printString("Have fun :) ", 0,3);
+ lcd.printString("Press A ", 0,4);
+ lcd.printString("to play! ", 0,5);
+ wait_ms(20);
+}
+
+void GraphicEngine::newLevel1()
+{
+ lcd.printString("|------------|", 0,0);
+ lcd.printString("| 1 |", 0,1);
+ lcd.printString("| |", 0,2);
+ lcd.printString("| |", 0,3);
+ lcd.printString("| |", 0,4);
+ lcd.printString("|------------|", 0,5);
+}
+
+
+void GraphicEngine::newLevel2()
+{
+ lcd.printString("|------------|", 0,0);
+ lcd.printString("| |", 0,1);
+ lcd.printString("| 2 |", 0,2);
+ lcd.printString("| |", 0,3);
+ lcd.printString("| |", 0,4);
+ lcd.printString("|------------|", 0,5);
+}
+
+
+void GraphicEngine::newLevel3()
+{
+ lcd.printString("|------------|", 0,0);
+ lcd.printString("| |", 0,1);
+ lcd.printString("| 3 |", 0,2);
+ lcd.printString("| |", 0,3);
+ lcd.printString("| |", 0,4);
+ lcd.printString("|------------|", 0,5);
+}
+
+
+void GraphicEngine::newLevelIntro()
+{
+ lcd.printString("|------------|", 0,0);
+ lcd.printString("| |", 0,1);
+ lcd.printString("| |", 0,2);
+ lcd.printString("| LEVEL 2 |", 0,3);
+ lcd.printString("| |", 0,4);
+ lcd.printString("|------------|", 0,5);
+}
+
+void GraphicEngine::newLevelGo()
+{
+ lcd.printString("|------------|", 0,0);
+ lcd.printString("| |", 0,1);
+ lcd.printString("| |", 0,2);
+ lcd.printString("| |", 0,3);
+ lcd.printString("| GO! |", 0,4);
+ lcd.printString("|------------|", 0,5);
+}
void GraphicEngine::init()
{
lcd.init();
@@ -112,9 +223,9 @@
lcd.drawSprite(0, 48 - 4*6, 4, 83, (int *)safety_zone); // row 6 -> middle(ish)
}
-void GraphicEngine::drawEndPost()
+void GraphicEngine::drawEndPost(int x_pos)
{
- lcd.drawSprite(24, 48 - 4*11, 8, 12, (int *)goal_post);
+ lcd.drawSprite(x_pos, 48 - 4*11, 8, 12, (int *)goal_post);
}
void GraphicEngine::printTest()
@@ -132,3 +243,8 @@
lcd.printString("LOSER!!!!",1,1);
}
+void GraphicEngine::printCongrats()
+{
+ lcd.printString("CONGTATS NEXT LEVEL!!!!",1,1);
+}
+