ECE 2036 Project
Dependencies: mbed wave_player 4DGL-uLCD-SE
game.h
- Committer:
- rconnorlawson
- Date:
- 2017-11-03
- Revision:
- 0:cf4396614a79
- Child:
- 2:2042f29de6b7
File content as of revision 0:cf4396614a79:
#pragma once #include "physics.h" #include "doublely_linked_list.h" /* A structure for holding all the game inputs */ struct GameInputs { // Measurements from the accelerometer double ax, ay, az; }; ////////////////////////// // Arena Element structs ////////////////////////// /** The basic ArenaElement structure. Every item in an arena DLinkedList should be able to be cast to this struct. The type member is used to tell what other struct this element might be. */ struct ArenaElement { int type; }; // Element types #define WALL 0 #define BALL 1 /** An ArenaElement struct representing the ball. */ struct Ball { // ArenaElement type (must be first element) int type; // Drawing info int x, y; }; ///////////////////////// // ArenaElement helpers ///////////////////////// /** Erases the ball */ void erase_ball(Ball* ball); /** Draws the ball at the current state */ void draw_ball(Ball* ball, Physics* state); /* Add additional helpers for other ArenaElement types here */ /////////////////////////// // Game control functions /////////////////////////// /* Reads all game inputs */ GameInputs read_inputs(); /* Performs a single physics update. */ int update_game(DLinkedList* arena, Physics* prev, GameInputs inputs, float delta); /* Implements the game loop */ int run_game(DLinkedList* arena, Physics* state);