ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el19tb

Dependencies:   mbed

Revision:
47:29c4796a49e5
Parent:
46:e39abe665271
Child:
48:8ccfc74b60a5
diff -r e39abe665271 -r 29c4796a49e5 GraphicEngine/GraphicEngine.cpp
--- a/GraphicEngine/GraphicEngine.cpp	Sat May 23 02:55:16 2020 +0000
+++ b/GraphicEngine/GraphicEngine.cpp	Sat May 23 03:53:33 2020 +0000
@@ -82,9 +82,23 @@
 }
 
 /* TO-DO: ADD SPRITES AND SPRITE STATE */
-void GraphicEngine::showFrog(float x, int y, int width, int height)
+void GraphicEngine::showFrog(float x, int y, int width, int height, int state)
 {
-    lcd.drawRect(x, y, width, height, FILL_BLACK);
+    switch(state)
+    {
+        case 0:
+            lcd.drawSprite(x, y, 4, 6, (int *)frog_state_up);
+            break;
+        case 1: 
+            lcd.drawSprite(x, y, 4, 6, (int *)frog_state_left);
+            break;
+        case 2: 
+            lcd.drawSprite(x, y, 4, 6, (int *)frog_state_right);
+            break;
+        case 3: 
+            lcd.drawSprite(x, y, 4, 6, (int *)frog_state_down);
+            break;
+    }
 }
 
 void GraphicEngine::drawGoal(int x, int row)