Sprite rotation demo for the Gameduino

Dependencies:   Gameduino mbed

Files at this revision

API Documentation at this revision

Comitter:
TheChrisyd
Date:
Thu Dec 20 22:29:18 2012 +0000
Child:
1:aa81a7885cfc
Commit message:
Working version

Changed in this revision

Gameduino.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
r.h Show annotated file Show diff for this revision Revisions of this file
shield.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Gameduino.lib	Thu Dec 20 22:29:18 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/TheChrisyd/code/Gameduino/#141b6d4c3c30
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Dec 20 22:29:18 2012 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+#include "GD.h"
+#include "r.h"
+#include "shield.h"
+
+GDClass GD(ARD_MOSI, ARD_MISO, ARD_SCK, ARD_D9, USBTX, USBRX) ;
+
+int main()
+{
+  int i;
+
+  GD.begin();
+  GD.ascii();
+  GD.putstr(0, 0,"Sprite rotation");
+
+  GD.copy(RAM_SPRIMG, r_img, sizeof(r_img));
+  GD.copy(RAM_SPRPAL, r_pal, sizeof(r_pal));
+
+  for (i = 0; i < 8; i++) {
+    char msg[] = "ROT=.";
+    byte y = 3 + 4 * i;
+    msg[4] = '0' + i;
+    GD.putstr(18, y, msg);
+    GD.sprite(i, 200, 8 * y, 0, 0, i);
+  }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Dec 20 22:29:18 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/078e4b97a13e
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/r.h	Thu Dec 20 22:29:18 2012 +0000
@@ -0,0 +1,55 @@
+static PROGMEM prog_uchar r_img[] = {
+
+0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e, 
+0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e, 
+0x0e,  0x0e,  0x0e,  0x0e,  0x00,  0x00,  0x00,  0x00,  0x02,  0x05,  0x09,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e, 
+0x0e,  0x0e,  0x0e,  0x0e,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x09,  0x0e,  0x0e,  0x0e,  0x0e, 
+0x0e,  0x0e,  0x0e,  0x0e,  0x00,  0x00,  0x0e,  0x0e,  0x0c,  0x07,  0x00,  0x04,  0x0e,  0x0e,  0x0e,  0x0e, 
+0x0e,  0x0e,  0x0e,  0x0e,  0x00,  0x00,  0x0e,  0x0e,  0x0e,  0x0c,  0x00,  0x01,  0x0e,  0x0e,  0x0e,  0x0e, 
+0x0e,  0x0e,  0x0e,  0x0e,  0x00,  0x00,  0x0e,  0x0e,  0x0e,  0x0c,  0x00,  0x02,  0x0e,  0x0e,  0x0e,  0x0e, 
+0x0e,  0x0e,  0x0e,  0x0e,  0x00,  0x00,  0x0e,  0x0e,  0x0c,  0x07,  0x00,  0x06,  0x0e,  0x0e,  0x0e,  0x0e, 
+0x0e,  0x0e,  0x0e,  0x0e,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x05,  0x0c,  0x0e,  0x0e,  0x0e,  0x0e, 
+0x0e,  0x0e,  0x0e,  0x0e,  0x00,  0x00,  0x00,  0x00,  0x00,  0x02,  0x0a,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e, 
+0x0e,  0x0e,  0x0e,  0x0e,  0x00,  0x00,  0x0e,  0x0d,  0x09,  0x01,  0x01,  0x0b,  0x0e,  0x0e,  0x0e,  0x0e, 
+0x0e,  0x0e,  0x0e,  0x0e,  0x00,  0x00,  0x0e,  0x0e,  0x0e,  0x08,  0x00,  0x05,  0x0e,  0x0e,  0x0e,  0x0e, 
+0x0e,  0x0e,  0x0e,  0x0e,  0x00,  0x00,  0x0e,  0x0e,  0x0e,  0x0d,  0x04,  0x00,  0x08,  0x0e,  0x0e,  0x0e, 
+0x0e,  0x0e,  0x0e,  0x0e,  0x00,  0x00,  0x0e,  0x0e,  0x0e,  0x0e,  0x0a,  0x00,  0x02,  0x0c,  0x0e,  0x0e, 
+0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e, 
+0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e,  0x0e, 
+};
+static PROGMEM prog_uchar r_pal[] = {
+
+0xff,  0x7f,  0xff,  0x7f,  0xdf,  0x7b,  0xbf,  0x77,  0x5f,  0x6f,  0x3f,  0x6b,  0xbf,  0x5e,  0x7f,  0x5a, 
+0xbf,  0x45,  0x7f,  0x41,  0x3f,  0x39,  0x9f,  0x28,  0x5f,  0x24,  0x1f,  0x1c,  0x1f,  0x1c,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00, 
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shield.h	Thu Dec 20 22:29:18 2012 +0000
@@ -0,0 +1,48 @@
+#define ARD_D0 p27
+#define ARD_D1 p28
+#define ARD_D2 p29
+#define ARD_D3 p21
+#define ARD_D4 p30
+#define ARD_D5 p22
+#define ARD_D6 p23
+#define ARD_D7 p11
+#define ARD_D8 p12
+#define ARD_D9 p24
+#define ARD_D10 p25
+#define ARD_D11 p5
+#define ARD_D12 p6
+#define ARD_D13 p7
+
+#define ARD_D14 ARD_A0
+#define ARD_D15 ARD_A1
+#define ARD_D16 ARD_A2
+#define ARD_D17 ARD_A3
+#define ARD_D18 ARD_SDA
+#define ARD_D19 ARD_SCL
+
+#define ARD_A0 p15
+#define ARD_A1 p16
+#define ARD_A2 p17
+#define ARD_A3 p18
+#define ARD_A4 p19
+#define ARD_A5 p20
+
+#define ARD_PWM0 ARD_D3
+#define ARD_PWM1 ARD_D5
+#define ARD_PWM2 ARD_D6
+#define ARD_PWM3 ARD_D9
+#define ARD_PWM4 ARD_D10
+#define ARD_PWM5 p26
+
+#define ARD_RX ARD_D0
+#define ARD_TX ARD_D1
+#define ARD_SDA p9
+#define ARD_SCL p10
+#define ARD_MOSI p5
+#define ARD_MISO p6
+#define ARD_SCK p7
+/*
+DigitalOut shield_d13(ARD_D13);
+
+AnalogIn shield_a0(ARD_A0);
+*/
\ No newline at end of file