Still won't work
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
graphics.cpp
00001 #include "graphics.h" 00002 00003 #include "globals.h" 00004 00005 00006 00007 void draw_player(int u, int v, int key) 00008 { 00009 uLCD.filled_rectangle(u, v, u+11, v+11, RED); 00010 } 00011 00012 #define YELLOW 0xFFFF00 00013 #define BROWN 0xD2691E 00014 #define DIRT BROWN 00015 void draw_img(int u, int v, const char* img) 00016 { 00017 int colors[11*11]; 00018 for (int i = 0; i < 11*11; i++) 00019 { 00020 if (img[i] == 'R') colors[i] = RED; 00021 else if (img[i] == 'Y') colors[i] = YELLOW; 00022 else if (img[i] == 'G') colors[i] = GREEN; 00023 else if (img[i] == 'D') colors[i] = DIRT; 00024 else if (img[i] == '5') colors[i] = LGREY; 00025 else if (img[i] == '3') colors[i] = DGREY; 00026 else colors[i] = BLACK; 00027 } 00028 uLCD.BLIT(u, v, 11, 11, colors); 00029 wait_us(250); // Recovery time! 00030 } 00031 00032 void draw_nothing(int u, int v) 00033 { 00034 // Fill a tile with blackness 00035 uLCD.filled_rectangle(u, v, u+10, v+10, BLACK); 00036 } 00037 00038 void draw_wall(int u, int v) 00039 { 00040 uLCD.filled_rectangle(u, v, u+10, v+10, BROWN); 00041 } 00042 00043 void draw_plant(int u, int v) 00044 { 00045 uLCD.filled_rectangle(u, v, u+10, v+10, GREEN); 00046 } 00047 00048 void draw_upper_status() 00049 { 00050 // Draw bottom border of status bar 00051 uLCD.line(0, 9, 127, 9, GREEN); 00052 00053 // Add other status info drawing code here 00054 } 00055 00056 void draw_lower_status() 00057 { 00058 // Draw top border of status bar 00059 uLCD.line(0, 118, 127, 118, GREEN); 00060 00061 // Add other status info drawing code here 00062 } 00063 00064 void draw_border() 00065 { 00066 uLCD.filled_rectangle(0, 9, 127, 14, WHITE); // Top 00067 uLCD.filled_rectangle(0, 13, 2, 114, WHITE); // Left 00068 uLCD.filled_rectangle(0, 114, 127, 117, WHITE); // Bottom 00069 uLCD.filled_rectangle(124, 14, 127, 117, WHITE); // Right 00070 } 00071 00072
Generated on Fri Aug 19 2022 16:39:02 by 1.7.2