ECE 2036 Project

Dependencies:   mbed wave_player 4DGL-uLCD-SE

Revision:
0:cf4396614a79
Child:
2:2042f29de6b7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wall.h	Fri Nov 03 18:48:48 2017 +0000
@@ -0,0 +1,53 @@
+#pragma once
+
+// Forward declarations
+struct Physics;
+struct Entity;
+
+/**
+ * Structure to represent a Wall in the arena.
+ * 
+ * This structure is a ArenaElement; its first data element is an integer (type)
+ * whose value is always WALL.
+ */
+struct Wall {
+    int type;
+    int direction;
+    int x, y;
+    int length;
+    float bounce;
+    int should_draw;
+};
+
+// Directions
+#define HORIZONTAL  0
+#define VERTICAL    1
+
+/**
+ * Allocate and initialize a new wall object.
+ *
+ * @param[in] direction The direction of the wall (HORIZONTAL or VERTICAL)
+ * @param[in] x         The x location of the origin of the wall
+ * @param[in] y         The y location of the origin of the wall
+ * @param[in] length    The length of the wall. (HORIZONTAL = right, VERTICAL = down)
+ * @param[in] bounce    The coefficient of bounciness for the wall. Between 0 and 1.
+ * @return              The newly initialized wall.
+ */
+Wall* create_wall(int direction, int x, int y, int length, float bounce);
+
+/**
+ * Computes the physics update for a wall.
+ *
+ * @param[out] phys The result physics update. Assumed valid at function start.
+ * @param[in]  ball The ball to update
+ * @param[in]  wall The wall to bounce off of
+ * @param[in]  delta The elapsed time, in seconds, since the previous update
+ */
+void do_wall(Physics* next, const Physics* curr, Wall* wall, float delta);
+
+/**
+ * Draws a given wall to the screen.
+ * 
+ * @param[in] wall  The wall to draw
+ */
+void draw_wall(Wall* wall);