Gatech ECE 4180 Lab 4 Deal or No Deal Game -Alex Ferrara -Luke LeFeve
Dependencies: 4DGL-uLCD-SE SDFileSystem mbed wave_player
main.cpp
- Committer:
- AlexFerrara
- Date:
- 2016-10-31
- Revision:
- 0:a9fc9a400a0a
- Child:
- 1:13d194e38ea6
File content as of revision 0:a9fc9a400a0a:
#include "mbed.h" #include "uLCD_4DGL.h" void draw_case(int x, int y); void draw_case_grid(void); uLCD_4DGL uLCD(p28,p27,p30); int G_HANDLE_HEIGHT = 1; int G_HANDLE_LENGTH = 2; int G_CASE_HEIGHT = 2; int G_CASE_LENGTH = 3; void draw_case(int x, int y, int scale){ //uLCD.pen_size(1); int HANDLE_HEIGHT = G_HANDLE_HEIGHT * scale; int HANDLE_LENGTH = G_HANDLE_LENGTH * scale; int CASE_HEIGHT = G_CASE_HEIGHT * scale; int CASE_LENGTH = G_CASE_LENGTH * scale; int HANDLE_OFFSET = (CASE_LENGTH - HANDLE_LENGTH) /2; //handle uLCD.rectangle(x+HANDLE_OFFSET, y, x+HANDLE_OFFSET+HANDLE_LENGTH, y+HANDLE_HEIGHT, LGREY); //main section uLCD.filled_rectangle(x, y+HANDLE_HEIGHT, x+CASE_LENGTH, y+HANDLE_HEIGHT+CASE_HEIGHT, WHITE); uLCD.rectangle(x, y+HANDLE_HEIGHT, x+CASE_LENGTH, y+HANDLE_HEIGHT+CASE_HEIGHT, LGREY); //uLCD.printf("%d, %d",x+HANDLE_HEIGHT+(CASE_HEIGHT/2), y+CASE_LENGTH/2); } void draw_case_grid(void){ uLCD.textbackground_color(WHITE); //draw 12 cases int text_offset_x = 7; int text_offset_y = 4; int xPos[] = {0,33,66,99};//,0,33,66,99,0,33,66,99]; int yPos[] = {0,33,66}; for(int i=0; i<12; i++){ draw_case(xPos[i%4]+text_offset_x,yPos[i%3]+text_offset_y,7); } //print nums uLCD.text_string("1", 2, 2, NULL, BLACK); uLCD.text_string(" 2", 6, 2, NULL, BLACK); uLCD.text_string(" 3", 11, 2, NULL, BLACK); uLCD.text_string("4", 16, 2, NULL, BLACK); uLCD.text_string("5", 2, 6, NULL, BLACK); uLCD.text_string(" 6", 6, 6, NULL, BLACK); uLCD.text_string(" 7", 11, 6, NULL, BLACK); uLCD.text_string("8", 16, 6, NULL, BLACK); uLCD.text_string("9", 2, 10, NULL, BLACK); uLCD.text_string("10", 6, 10, NULL, BLACK); uLCD.text_string("11", 11, 10, NULL, BLACK); uLCD.text_string("12", 16, 10, NULL, BLACK); draw_case(20,100,8); } int main() { draw_case_grid(); }