![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
test 1 doc
Diff: main.cpp
- Revision:
- 5:928c2eee4109
- Parent:
- 4:cf5088ace087
- Child:
- 7:530ca713d2b2
diff -r cf5088ace087 -r 928c2eee4109 main.cpp --- a/main.cpp Mon May 18 18:46:13 2020 +0000 +++ b/main.cpp Fri May 22 01:26:24 2020 +0000 @@ -35,6 +35,8 @@ void init(); void display(); + + int main() { @@ -44,17 +46,17 @@ int fps = 10; // frames per second display(); // first draw the initial frame wait(1.0f/fps); // and wait for one frame period - // game loop - read input, update the game state and render the display + // game loop while (1) { - lcd.setContrast( pad.read_pot1()); - - engine.read_input(pad); - engine.update(pad); - display(); - wait(1.0f/fps); - } + lcd.setContrast( pad.read_pot1()); //contrast set by pot1 + engine.read_input(pad); //reads input from pad + engine.update(pad); //update physics and calculations + display(); //display on screen + wait(1.0f/fps); //wait for fps + } } +//initialisation void init() { lcd.init(); @@ -62,6 +64,7 @@ engine.init(); } +//display function by clearing, updating and refreshing void display() { lcd.clear();