ECE 2036 Project

Dependencies:   mbed wave_player 4DGL-uLCD-SE

Committer:
rconnorlawson
Date:
Fri Nov 03 18:48:48 2017 +0000
Revision:
0:cf4396614a79
Child:
2:2042f29de6b7
Emptied shell code (including doubly linked list) and added comments for all the functionality.;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rconnorlawson 0:cf4396614a79 1 #pragma once
rconnorlawson 0:cf4396614a79 2
rconnorlawson 0:cf4396614a79 3 // Forward declarations
rconnorlawson 0:cf4396614a79 4 struct Physics;
rconnorlawson 0:cf4396614a79 5 struct Entity;
rconnorlawson 0:cf4396614a79 6
rconnorlawson 0:cf4396614a79 7 /**
rconnorlawson 0:cf4396614a79 8 * Structure to represent a Wall in the arena.
rconnorlawson 0:cf4396614a79 9 *
rconnorlawson 0:cf4396614a79 10 * This structure is a ArenaElement; its first data element is an integer (type)
rconnorlawson 0:cf4396614a79 11 * whose value is always WALL.
rconnorlawson 0:cf4396614a79 12 */
rconnorlawson 0:cf4396614a79 13 struct Wall {
rconnorlawson 0:cf4396614a79 14 int type;
rconnorlawson 0:cf4396614a79 15 int direction;
rconnorlawson 0:cf4396614a79 16 int x, y;
rconnorlawson 0:cf4396614a79 17 int length;
rconnorlawson 0:cf4396614a79 18 float bounce;
rconnorlawson 0:cf4396614a79 19 int should_draw;
rconnorlawson 0:cf4396614a79 20 };
rconnorlawson 0:cf4396614a79 21
rconnorlawson 0:cf4396614a79 22 // Directions
rconnorlawson 0:cf4396614a79 23 #define HORIZONTAL 0
rconnorlawson 0:cf4396614a79 24 #define VERTICAL 1
rconnorlawson 0:cf4396614a79 25
rconnorlawson 0:cf4396614a79 26 /**
rconnorlawson 0:cf4396614a79 27 * Allocate and initialize a new wall object.
rconnorlawson 0:cf4396614a79 28 *
rconnorlawson 0:cf4396614a79 29 * @param[in] direction The direction of the wall (HORIZONTAL or VERTICAL)
rconnorlawson 0:cf4396614a79 30 * @param[in] x The x location of the origin of the wall
rconnorlawson 0:cf4396614a79 31 * @param[in] y The y location of the origin of the wall
rconnorlawson 0:cf4396614a79 32 * @param[in] length The length of the wall. (HORIZONTAL = right, VERTICAL = down)
rconnorlawson 0:cf4396614a79 33 * @param[in] bounce The coefficient of bounciness for the wall. Between 0 and 1.
rconnorlawson 0:cf4396614a79 34 * @return The newly initialized wall.
rconnorlawson 0:cf4396614a79 35 */
rconnorlawson 0:cf4396614a79 36 Wall* create_wall(int direction, int x, int y, int length, float bounce);
rconnorlawson 0:cf4396614a79 37
rconnorlawson 0:cf4396614a79 38 /**
rconnorlawson 0:cf4396614a79 39 * Computes the physics update for a wall.
rconnorlawson 0:cf4396614a79 40 *
rconnorlawson 0:cf4396614a79 41 * @param[out] phys The result physics update. Assumed valid at function start.
rconnorlawson 0:cf4396614a79 42 * @param[in] ball The ball to update
rconnorlawson 0:cf4396614a79 43 * @param[in] wall The wall to bounce off of
rconnorlawson 0:cf4396614a79 44 * @param[in] delta The elapsed time, in seconds, since the previous update
rconnorlawson 0:cf4396614a79 45 */
rconnorlawson 0:cf4396614a79 46 void do_wall(Physics* next, const Physics* curr, Wall* wall, float delta);
rconnorlawson 0:cf4396614a79 47
rconnorlawson 0:cf4396614a79 48 /**
rconnorlawson 0:cf4396614a79 49 * Draws a given wall to the screen.
rconnorlawson 0:cf4396614a79 50 *
rconnorlawson 0:cf4396614a79 51 * @param[in] wall The wall to draw
rconnorlawson 0:cf4396614a79 52 */
rconnorlawson 0:cf4396614a79 53 void draw_wall(Wall* wall);