ELEC2645 (2018/19) / Mbed 2 deprecated 2645_Project_SiutingWong201186503

Dependencies:   mbed

Revision:
6:a0f3dbbc8d33
Parent:
0:fd8eda608206
--- a/N5110/N5110.cpp	Wed May 08 21:01:54 2019 +0000
+++ b/N5110/N5110.cpp	Wed May 08 23:42:32 2019 +0000
@@ -431,4 +431,26 @@
             drawLine(x0,y,x0+(width-1),y,type);  // draw line across screen
         }
     }
+}
+
+void N5110::drawSprite(int x0,
+                      int y0,
+                      int nrows,
+                      int ncols,
+                      int *sprite)
+{ 
+    for (int i = 0; i < nrows; i++) {
+        for (int j = 0 ; j < ncols ; j++) {
+
+            int pixel = *((sprite+i*ncols)+j);
+
+            if (pixel) {
+                setPixel(x0+j,y0+i);
+            }
+            else {
+                clearPixel(x0+j,y0+i);    
+            }
+
+        }
+    }
 }
\ No newline at end of file