Still won't work
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
graphics.cpp
- Committer:
- jtrux
- Date:
- 2019-04-12
- Revision:
- 5:142e66c8a7fa
- Parent:
- 0:35660d7952f7
File content as of revision 5:142e66c8a7fa:
#include "graphics.h" #include "globals.h" void draw_player(int u, int v, int key) { uLCD.filled_rectangle(u, v, u+11, v+11, RED); } #define YELLOW 0xFFFF00 #define BROWN 0xD2691E #define DIRT BROWN void draw_img(int u, int v, const char* img) { int colors[11*11]; for (int i = 0; i < 11*11; i++) { if (img[i] == 'R') colors[i] = RED; else if (img[i] == 'Y') colors[i] = YELLOW; else if (img[i] == 'G') colors[i] = GREEN; else if (img[i] == 'D') colors[i] = DIRT; else if (img[i] == '5') colors[i] = LGREY; else if (img[i] == '3') colors[i] = DGREY; else colors[i] = BLACK; } uLCD.BLIT(u, v, 11, 11, colors); wait_us(250); // Recovery time! } void draw_nothing(int u, int v) { // Fill a tile with blackness uLCD.filled_rectangle(u, v, u+10, v+10, BLACK); } void draw_wall(int u, int v) { uLCD.filled_rectangle(u, v, u+10, v+10, BROWN); } void draw_plant(int u, int v) { uLCD.filled_rectangle(u, v, u+10, v+10, GREEN); } void draw_upper_status() { // Draw bottom border of status bar uLCD.line(0, 9, 127, 9, GREEN); // Add other status info drawing code here } void draw_lower_status() { // Draw top border of status bar uLCD.line(0, 118, 127, 118, GREEN); // Add other status info drawing code here } void draw_border() { uLCD.filled_rectangle(0, 9, 127, 14, WHITE); // Top uLCD.filled_rectangle(0, 13, 2, 114, WHITE); // Left uLCD.filled_rectangle(0, 114, 127, 117, WHITE); // Bottom uLCD.filled_rectangle(124, 14, 127, 117, WHITE); // Right }