api for drawing snake on a uVGA II

Dependents:   snake

Files at this revision

API Documentation at this revision

Comitter:
lucoby
Date:
Thu Oct 11 20:23:28 2012 +0000
Parent:
0:06f3e47afa60
Commit message:
updated draw apple

Changed in this revision

draw.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 06f3e47afa60 -r 2e528b145987 draw.cpp
--- a/draw.cpp	Thu Oct 11 18:54:40 2012 +0000
+++ b/draw.cpp	Thu Oct 11 20:23:28 2012 +0000
@@ -27,7 +27,12 @@
 }
 
 void drawApple(int row, int col) {
-    drawPixel(row, col, 0xFF0000);
+    //drawPixel(row, col, 0xFF0000);
+    ecran.rectangle(col*15 + 138, row*15 + 85, col*15 + 145, row*15 + 91, RED);
+    ecran.rectangle(col*15 + 137, row*15 + 87, col*15 + 146, row*15 + 89, RED);
+    ecran.rectangle(col*15 + 139, row*15 + 92, col*15 + 144, row*15 + 92, RED);
+    ecran.rectangle(col*15 + 137, row*15 + 84, col*15 + 143, row*15 + 84, GREEN);
+    ecran.rectangle(col*15 + 141, row*15 + 83, col*15 + 146, row*15 + 83, GREEN);
 }
 
 void drawBlank(int row, int col) {
@@ -35,9 +40,7 @@
 }
 
 void drawScore(int score) {
-        char scr[8];
-        ecran.rectangle(375,300,420,320,DGREY);
-        scr = sprintf("%d", score);
-        ecran.text_string("Score: ", 320, 315, FONT_8X8, WHITE);        
-        ecran.text_string(scr, 376, 315, FONT_8X8, WHITE);        
+        char scr[15];
+        sprintf(scr, "Score: %d", score);  
+        ecran.text_string(scr, 285, 302, FONT_8X8, WHITE);        
 }
\ No newline at end of file