testing documentation
Dependencies: mbed ll16j23s_test_docs
Diff: main.cpp
- Revision:
- 4:ea3fa51c4386
- Parent:
- 3:fcd6d70e9694
- Child:
- 5:06fa7674622a
--- a/main.cpp Wed May 20 21:25:40 2020 +0000 +++ b/main.cpp Sat May 23 15:31:30 2020 +0000 @@ -34,7 +34,6 @@ pad.init(); float speed = 0.5; - int cell_size = 2; int fps = 25; int frame_t = 1000/fps; @@ -56,25 +55,20 @@ {4, -1, 0, {4,1,4,3,4}} // West, will not go to centre or east }; */ - while(1){ + while(death == false){ - printf("Running!"); + //printf("Running!"); speed = pad.read_pot2(); -/* - if ((x_head % cell_size) + (y_head % cell_size) == 0) { // only allows changing movement when the snake is cell-aligned - d = pad.get_cardinal(); // gets joystick cardinal direction: 0 for centre, 1 - 4 for NESW respectively - state = fsm[state].nextState[d]; // adjusts direction fsm state based on direction - } -*/ - /* - x_head += fsm[state].delta_x; // increments x value based on fsm state value - y_head += fsm[state].delta_y; // increments y value based on fsm state value - - x_head = ((x_head % X_MAX) + X_MAX)% X_MAX; // wraps x back to within range 0-83 - y_head = ((y_head % Y_MAX) + Y_MAX)% Y_MAX; // wraps y back to within range 0-83 - */ + lcd.clear(); + snake.move_body(pad, lcd, death); + lcd.setContrast(0.4); + lcd.refresh(); + wait_ms(500/(5+snake.score)); + } +} + /* if ((lcd.getPixel(x, y) == 1 && ((state == 1) || (state == 4))) || (lcd.getPixel(x+1, y+1) == 1 && ((state == 2) || (state == 3)))) { // checks infront of head to see if pixel is set // due to the size of the head, there is an offset for the check for North and Eastward directions @@ -111,17 +105,5 @@ body[i][1] = 0; } */ - - lcd.clear(); - lcd.setContrast(0.5); - - //for(int i = 0; i < length; i++) { - //lcd.drawRect(body_x[i],body_y[i],cell_size,cell_size,FILL_BLACK); - //} - - //lcd.drawRect(10,10,6,6,FILL_BLACK); - lcd.refresh(); - wait_ms(25/speed); - } -} +