
Lab1
Diff: graphics.h
- Revision:
- 0:cb8d734a17f1
- Child:
- 7:45e908a56319
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphics.h Tue Nov 03 15:38:31 2020 +0000 @@ -0,0 +1,49 @@ +static char sprite1[] = +{0x20,0x80,0x11,0x00,0x3F,0x80,0x6E,0xC0,0xFF,0xE0,0xBF,0xA0,0xA0,0xA0,0x1B ,0x00} ; +static char sprite2[] = +{0x20,0x80,0x91,0x20,0xBF,0xA0,0xEE,0xE0,0xFF,0xE0,0x3F,0x80,0x20,0x80,0x1B ,0x00} ; + +static char shooter[] = +{0x04,0x00,0x0E,0x00,0x0E,0x00,0x7F,0xC0,0xFF,0xE0,0xFF,0xE0,0xFF,0xE0,0xFF ,0xE0} ; + +struct sprite{ + char snum; //sprite number + int xpos; // x position + int ypos; // y position + int oldy; // prvious y pos + char active; // 1 = sprite displayed 0 = sprite destroyed + char *type; //sprite1 or 2 +}; + + +sprite spritetab[] = { + {0,1,0,0,1,sprite1}, + {1,16,0,0,1,sprite2}, + {2,32,0,0,1,sprite1}, + {3,48,0,0,1,sprite2}, + {4,64,0,0,1,sprite1}, + {5,80,0,0,1,sprite2}, + {6,96,0,0,1,sprite1}, + {7,112,0,0,1,sprite2} +}; +// Some defines +#define WIN 1 +#define LOSE 0 +#define BASE 24 // the display baseline Y location for the shooter +//LCD display +C12832 lcd(p5, p7, p6, p8, p11); +// The 4 on board LEDs +DigitalOut myled(LED1); +DigitalOut myled2(LED2); +DigitalOut myled3(LED3); +DigitalOut myled4(LED4); +// RGB LED +PwmOut r (p23); +PwmOut g (p24); +//PwmOut b (p25); + //joystick + DigitalIn joyD(p12); + DigitalIn joyL(p13); + DigitalIn joyC(p14); + DigitalIn joyU(p15); + DigitalIn joyR(p16); \ No newline at end of file