ELEC2645 (2018/19) / Mbed 2 deprecated el17cd

Dependencies:   mbed

Committer:
el17cd
Date:
Tue May 07 16:57:26 2019 +0000
Revision:
39:41dcf1604fdf
Parent:
37:524b91130885
Added doxygen code example for structs

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el17cd 4:759a5c34e239 1 #include "mbed.h"
el17cd 4:759a5c34e239 2 #ifndef FACE_H
el17cd 4:759a5c34e239 3 #define FACE_H
el17cd 4:759a5c34e239 4 #include "Face.h"
el17cd 4:759a5c34e239 5 #endif
el17cd 32:9c250eda7f3f 6
el17cd 23:eb50ab95bb53 7 /** Cube class
el17cd 37:524b91130885 8 *@brief A class used to instantiate a Cube object, this is the obstacle in the game and can be manipulated using the rotate and translate functions.
el17cd 37:524b91130885 9 The cubes will be constantly moving towards the user at an increasing speed proportional to the score, using the joystick will translate the cubes horizontally
el17cd 37:524b91130885 10 so that the user can dodge them.
el17cd 23:eb50ab95bb53 11 *@author Christopher Doel
el17cd 23:eb50ab95bb53 12 *@date April, 2019
el17cd 23:eb50ab95bb53 13 */
el17cd 4:759a5c34e239 14 class Cube {
el17cd 4:759a5c34e239 15 private:
el17cd 17:3c9672c6e532 16 float verticies[8][3];
el17cd 4:759a5c34e239 17 Face faces[6];
el17cd 17:3c9672c6e532 18 float xPos, yPos, zPos;
el17cd 35:fe3956825bd8 19 /** sets the verticies of all the cubes faces depending on the location and size of the cube
el17cd 25:3995271e411c 20 *@param The memory address of the two dimentional float array which stores all x, y, z coordinates for each 8 verticies
el17cd 25:3995271e411c 21 */
el17cd 36:6fbafc8bed80 22 void updateFacesVerticies(float (&vert)[8][3]);
el17cd 35:fe3956825bd8 23 /** sets the verticies of an individual face of the cube
el17cd 25:3995271e411c 24 *@param The memory address of the two dimentional float array which stores all x, y, z coordinates for the first face verticies
el17cd 25:3995271e411c 25 *@param The memory address of the two dimentional float array which stores all x, y, z coordinates for the second face verticies
el17cd 25:3995271e411c 26 *@param The memory address of the two dimentional float array which stores all x, y, z coordinates for the third face verticies
el17cd 25:3995271e411c 27 *@param The memory address of the two dimentional float array which stores all x, y, z coordinates for the fourth face verticies
el17cd 25:3995271e411c 28 *@param The memory address of the two dimentional float array which stores all x, y, z coordinates for the fifth face verticies
el17cd 25:3995271e411c 29 *@param The memory address of the two dimentional float array which stores all x, y, z coordinates for the sixth faces verticies
el17cd 25:3995271e411c 30 */
el17cd 36:6fbafc8bed80 31 void assignFacesVerticies(float (&face0Points)[4][3],
el17cd 36:6fbafc8bed80 32 float (&face1Points)[4][3], float (&face2Points)[4][3],
el17cd 36:6fbafc8bed80 33 float (&face3Points)[4][3], float (&face4Points)[4][3],
el17cd 36:6fbafc8bed80 34 float (&face5Points)[4][3]);
el17cd 36:6fbafc8bed80 35
el17cd 4:759a5c34e239 36 public:
el17cd 35:fe3956825bd8 37 /** The constructor of the Cube class which instantiates the cube object.
el17cd 23:eb50ab95bb53 38 *No parameters are required as the cube is initially created with a size of 5 and a position at the origin.
el17cd 23:eb50ab95bb53 39 */
el17cd 36:6fbafc8bed80 40 Cube();
el17cd 35:fe3956825bd8 41 /** An accessor method which gets a face of the cube depending on the index provided
el17cd 23:eb50ab95bb53 42 *@param The integer index of the face required
el17cd 23:eb50ab95bb53 43 *@returns A face object corresponding to the index provided
el17cd 23:eb50ab95bb53 44 */
el17cd 36:6fbafc8bed80 45 Face getFace(int index);
el17cd 39:41dcf1604fdf 46 /** Sets the front, left and right faces of the cube to be visible so that they will be rendered (only these 3 are ever seen during gameplay)
el17cd 39:41dcf1604fdf 47 */
el17cd 39:41dcf1604fdf 48 void setPartiallyVisible();
el17cd 39:41dcf1604fdf 49 /** Sets the faces of the cube to be visible so that they will be rendered
el17cd 23:eb50ab95bb53 50 */
el17cd 36:6fbafc8bed80 51 void setVisible();
el17cd 35:fe3956825bd8 52 /** Returns whether the cube is too close to the perspective of the user
el17cd 23:eb50ab95bb53 53 *@returns a boolean indicating whether it is too close or not
el17cd 23:eb50ab95bb53 54 */
el17cd 36:6fbafc8bed80 55 bool tooClose();
el17cd 36:6fbafc8bed80 56 /** Performs a rotation in the X axis about the cubes centre
el17cd 36:6fbafc8bed80 57 *@param The angle in which to rotate the cube in terms of radians, provided as a float
el17cd 36:6fbafc8bed80 58 */
el17cd 17:3c9672c6e532 59 void rotateX(float angle);
el17cd 36:6fbafc8bed80 60 /** Performs a rotation in the Y axis about the cubes centre
el17cd 23:eb50ab95bb53 61 *@param The angle in which to rotate the cube in terms of radians, provided as a float
el17cd 23:eb50ab95bb53 62 */
el17cd 17:3c9672c6e532 63 void rotateY(float angle);
el17cd 36:6fbafc8bed80 64 /** Performs a rotation in the Z axis about the cubes centre
el17cd 23:eb50ab95bb53 65 *@param The angle in which to rotate the cube in terms of radians, provided as a float
el17cd 23:eb50ab95bb53 66 */
el17cd 17:3c9672c6e532 67 void rotateZ(float angle);
el17cd 35:fe3956825bd8 68 /** Performs a translation in all axis
el17cd 23:eb50ab95bb53 69 *@param The x offset
el17cd 23:eb50ab95bb53 70 *@param The y offset
el17cd 23:eb50ab95bb53 71 *@param The z offset
el17cd 23:eb50ab95bb53 72 */
el17cd 36:6fbafc8bed80 73 void translate(float x, float y, float z);
el17cd 35:fe3956825bd8 74 /** Resets the position of the cube to the origin
el17cd 23:eb50ab95bb53 75 */
el17cd 36:6fbafc8bed80 76 void resetPos();
el17cd 35:fe3956825bd8 77 /** Returns whether the cube is behind the users perspective
el17cd 23:eb50ab95bb53 78 *@returns a boolean value as to whether it should be despawned or not
el17cd 23:eb50ab95bb53 79 */
el17cd 36:6fbafc8bed80 80 bool despawn();
el17cd 4:759a5c34e239 81 };