Revenge of the Mouse
Dependencies: 4DGL-uLCD-SE EthernetInterface Game_Synchronizer LCD_fonts MMA8452 SDFileSystem mbed-rtos mbed wave_player
Fork of 2035_Tanks_Shell by
main.cpp@5:cfec780c935b, 2015-10-15 (annotated)
- Committer:
- jford38
- Date:
- Thu Oct 15 22:07:40 2015 +0000
- Revision:
- 5:cfec780c935b
- Parent:
- 4:d8bd8b41468d
- Child:
- 6:3be57cf4bd33
Working graphics commands on LCDs.; circle, line, triangle, filled_circle, filled_rectangle, rectangle, etc.; ; pen_size() seems to kill the LCD's. Don't know why. Probably just gonna exclude it.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jford38 | 0:899c85cd266f | 1 | // THIS GUY LISTENS AND REPEATS. CLIENT. MASTER. |
jford38 | 0:899c85cd266f | 2 | // (It doesn't make sense, I know.) |
jford38 | 0:899c85cd266f | 3 | |
jford38 | 0:899c85cd266f | 4 | #include "mbed.h" |
jford38 | 0:899c85cd266f | 5 | #include "two_player.h" |
jford38 | 0:899c85cd266f | 6 | |
jford38 | 0:899c85cd266f | 7 | |
jford38 | 0:899c85cd266f | 8 | uLCD_2P uLCD(p28,p27,p26, PLAYER1); // serial tx, serial rx, reset pin; |
jford38 | 0:899c85cd266f | 9 | |
jford38 | 0:899c85cd266f | 10 | |
jford38 | 0:899c85cd266f | 11 | int main (void) { |
jford38 | 1:0589ea36661b | 12 | int* buttons; |
jford38 | 1:0589ea36661b | 13 | |
jford38 | 1:0589ea36661b | 14 | pc.printf("\033[2J\033[0;0H"); |
jford38 | 0:899c85cd266f | 15 | pc.printf("I'm alive! Player 1\n"); |
jford38 | 0:899c85cd266f | 16 | |
jford38 | 0:899c85cd266f | 17 | uLCD.init(); |
jford38 | 0:899c85cd266f | 18 | pc.printf("Initialized...\n"); |
jford38 | 5:cfec780c935b | 19 | |
jford38 | 5:cfec780c935b | 20 | float theta = 0; |
jford38 | 0:899c85cd266f | 21 | while(1) { |
jford38 | 3:3ddefff03cb2 | 22 | |
jford38 | 5:cfec780c935b | 23 | uLCD.line(64,64,64+50*cos(theta),64+50*sin(theta), BLACK); |
jford38 | 5:cfec780c935b | 24 | theta += 0.05; |
jford38 | 5:cfec780c935b | 25 | uLCD.line(64,64,64+50*cos(theta),64+50*sin(theta), RED); |
jford38 | 5:cfec780c935b | 26 | uLCD.circle(10,10,100, GREEN); |
jford38 | 5:cfec780c935b | 27 | uLCD.filled_circle(4,4,10, 0xAB); |
jford38 | 5:cfec780c935b | 28 | uLCD.triangle(10,10, 20,20, 20,40, 0xAB); |
jford38 | 5:cfec780c935b | 29 | uLCD.rectangle(100,100, 90,90, GREEN); |
jford38 | 5:cfec780c935b | 30 | uLCD.filled_rectangle(100,100, 110,110, 0xAB); |
jford38 | 5:cfec780c935b | 31 | uLCD.pixel(40, 40, WHITE); |
jford38 | 3:3ddefff03cb2 | 32 | |
jford38 | 0:899c85cd266f | 33 | uLCD.update(); |
jford38 | 1:0589ea36661b | 34 | buttons = uLCD.get_button_state(); |
jford38 | 5:cfec780c935b | 35 | //pc.printf("Button State: %x %x %x %x %x\n", buttons[0], buttons[1], buttons[2], buttons[3], buttons[4]); |
jford38 | 5:cfec780c935b | 36 | //pc.printf("\033[2J\033[0;0H"); |
jford38 | 3:3ddefff03cb2 | 37 | } |
jford38 | 0:899c85cd266f | 38 | } |