Dependencies: mbed
Diff: SnakeEngine/SnakeEngine.cpp
- Revision:
- 9:561e5681b7a6
- Parent:
- 8:a2b431b9b3f7
- Child:
- 10:62d8cb7742c3
--- a/SnakeEngine/SnakeEngine.cpp Thu Mar 22 14:52:08 2018 +0000 +++ b/SnakeEngine/SnakeEngine.cpp Tue Apr 03 12:24:18 2018 +0000 @@ -10,6 +10,29 @@ { } +/* +Direction get_snake_direction() +{ + + Direction output; + Direction input = get_input_dir(); + //int state = W; + + StateDirection fsm[4] = { + + {N,{N,E,N,W}}, + {E,{N,E,S,E}}, + {S,{S,E,S,W}}, + {W,{N,W,S,W}} +}; + + output = fsm[state].output; // set ouput depending on current state + state = fsm[state].nextState[input]; // read input (BusIn) and update curent state + + return output; + +} +*/ void SnakeEngine::init(int food_pos_x, int food_pos_y) { @@ -20,6 +43,7 @@ _fy = food_pos.y; _food.init(_fx,_fy); + } void SnakeEngine::draw(N5110 &lcd) @@ -29,4 +53,5 @@ lcd.setContrast(0.5); _food.update(); _food.draw(lcd); + } \ No newline at end of file