ELEC2645 (2018/19) / Mbed 2 deprecated el17cd

Dependencies:   mbed

Committer:
el17cd
Date:
Fri Apr 05 15:43:27 2019 +0000
Revision:
32:9c250eda7f3f
Parent:
31:e681177037ef
Child:
33:02c5048b3b3f
Removed unnecessary includes in .h files

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el17cd 31:e681177037ef 1 #include "mbed.h"
el17cd 31:e681177037ef 2 #include "N5110.h"
el17cd 31:e681177037ef 3 #ifndef FACE_H
el17cd 31:e681177037ef 4 #define FACE_H
el17cd 31:e681177037ef 5 #include "Face.h"
el17cd 31:e681177037ef 6 #endif
el17cd 31:e681177037ef 7 #ifndef CUBE_H
el17cd 31:e681177037ef 8 #define CUBE_H
el17cd 31:e681177037ef 9 #include "Cube.h"
el17cd 31:e681177037ef 10 #endif
el17cd 31:e681177037ef 11
el17cd 32:9c250eda7f3f 12 /** Face class
el17cd 32:9c250eda7f3f 13 *@brief A class used to instantiate a renderer object, this class provides an interface from the game to the display
el17cd 32:9c250eda7f3f 14 *@author Christopher Doel
el17cd 32:9c250eda7f3f 15 *@date April, 2019
el17cd 32:9c250eda7f3f 16 */
el17cd 31:e681177037ef 17 class Renderer {
el17cd 31:e681177037ef 18 private:
el17cd 31:e681177037ef 19 float fov;
el17cd 31:e681177037ef 20 Cube selectionCube;
el17cd 31:e681177037ef 21 public:
el17cd 31:e681177037ef 22 Renderer();
el17cd 31:e681177037ef 23 void init();
el17cd 31:e681177037ef 24 float xTo2D(float x, float z);
el17cd 31:e681177037ef 25 /** @brief Projects the 3D x coordinate to 2D perspective
el17cd 31:e681177037ef 26 *@param The 3d x coordinate as a float
el17cd 31:e681177037ef 27 *@param The 3d z coordinate as a float
el17cd 31:e681177037ef 28 *@returns The 2D perspective fo the x coordinate
el17cd 31:e681177037ef 29 */
el17cd 31:e681177037ef 30 float yTo2D(float y, float z);
el17cd 31:e681177037ef 31 /** @brief Projects the 3D y coordinate to 2D perspective
el17cd 31:e681177037ef 32 *@param The 3d y coordinate as a float
el17cd 31:e681177037ef 33 *@param The 3d z coordinate as a float
el17cd 31:e681177037ef 34 *@returns The 2D perspective of the y coordinate
el17cd 31:e681177037ef 35 */
el17cd 31:e681177037ef 36 void drawHorizon(float angle);
el17cd 31:e681177037ef 37 /** @brief Draws the games horizon line
el17cd 31:e681177037ef 38 *@param The angle of the horizon determined by the joystick position
el17cd 31:e681177037ef 39 */
el17cd 31:e681177037ef 40 void drawFace(Face *face, float angle);
el17cd 31:e681177037ef 41 /** @brief Draw an individual face
el17cd 31:e681177037ef 42 *@param The face object
el17cd 31:e681177037ef 43 *@param The angle of the face object as a float
el17cd 31:e681177037ef 44 */
el17cd 31:e681177037ef 45 void rasterizeFace(float (&points)[4][3], Face *face);
el17cd 31:e681177037ef 46 /** @brief Fill in the face
el17cd 31:e681177037ef 47 *@param The pointer to an array containing the verticies of the face
el17cd 31:e681177037ef 48 *@param The face object
el17cd 31:e681177037ef 49 */
el17cd 31:e681177037ef 50 void drawFillLines(float (&points)[4][3], int diffX2, int stepBottomY, int stepTopX, int stepTopY);
el17cd 31:e681177037ef 51 /** @brief Draw an individual face
el17cd 31:e681177037ef 52 *@param The pointer to an array containing the verticies of the face
el17cd 31:e681177037ef 53 *@param The integer difference between the top horizontal edge x coordinates
el17cd 31:e681177037ef 54 *@param The integer difference between right vertical edge y coordinates
el17cd 31:e681177037ef 55 *@param The integer difference between bottom horizontal edge x coordinates
el17cd 31:e681177037ef 56 *@param The integer difference between left horizontal edge y coordinates
el17cd 31:e681177037ef 57 */
el17cd 31:e681177037ef 58 void drawFaceOutline(float (&points)[4][3]);
el17cd 31:e681177037ef 59 /** @brief Draw the outline of the face
el17cd 31:e681177037ef 60 *@param The pointer to an array containing the verticies of the face
el17cd 31:e681177037ef 61 */
el17cd 31:e681177037ef 62 void drawAllFaces(Face *faceArray, int noOfFaces, float angle);
el17cd 31:e681177037ef 63 /** @brief Draw all faces within a face array
el17cd 31:e681177037ef 64 *@param The pointer to an array of face objects
el17cd 31:e681177037ef 65 *@param The number of faces as an integer
el17cd 31:e681177037ef 66 *@param The angle of the faces as a float
el17cd 31:e681177037ef 67 */
el17cd 31:e681177037ef 68 bool checkOnScreen(float (&Points)[4][3]);
el17cd 31:e681177037ef 69 /** @brief Checks whether any area of the face is on the screen
el17cd 31:e681177037ef 70 *@param The pointer to an array containing the verticies of the face
el17cd 31:e681177037ef 71 */
el17cd 31:e681177037ef 72 void print(const char *text, int x, int y);
el17cd 31:e681177037ef 73 /** @brief Prints a string at a desired location on the screen
el17cd 31:e681177037ef 74 *@param The pointer to an array of characters of the string
el17cd 31:e681177037ef 75 *@param The x coordinate to draw the string as an integer
el17cd 31:e681177037ef 76 *@param The y coordinate to draw the string as an integer
el17cd 31:e681177037ef 77 */
el17cd 31:e681177037ef 78 void printScore(int score, int x, int y);
el17cd 31:e681177037ef 79 /** @brief Prints a score at a desired location on the screen
el17cd 31:e681177037ef 80 *@param The value of the score as an integer
el17cd 31:e681177037ef 81 *@param The x coordinate to draw the score as an integer
el17cd 31:e681177037ef 82 *@param The y coordinate to draw the score as an integer
el17cd 31:e681177037ef 83 */
el17cd 31:e681177037ef 84 void clear();
el17cd 31:e681177037ef 85 /** @brief Clears the display
el17cd 31:e681177037ef 86 */
el17cd 31:e681177037ef 87 void refresh();
el17cd 31:e681177037ef 88 /** @brief Refreshes the display
el17cd 31:e681177037ef 89 */
el17cd 31:e681177037ef 90 void turnOff();
el17cd 31:e681177037ef 91 /** @brief Turns off the display
el17cd 31:e681177037ef 92 */
el17cd 31:e681177037ef 93 void drawDeathScreen(int selection, int highScore);
el17cd 31:e681177037ef 94 /** @brief Draws the screen after the user has collided with a cube
el17cd 31:e681177037ef 95 *@param The selected option as an integer
el17cd 31:e681177037ef 96 *@param The high score as an integer
el17cd 31:e681177037ef 97 */
el17cd 31:e681177037ef 98 void drawDeathButtons();
el17cd 31:e681177037ef 99 /** @brief Draws the death menus buttons
el17cd 31:e681177037ef 100 */
el17cd 31:e681177037ef 101 void drawHomeScreen(int selection);
el17cd 31:e681177037ef 102 /** @brief Draws the games home screen
el17cd 31:e681177037ef 103 *@param The selected option as an integer
el17cd 31:e681177037ef 104 */
el17cd 31:e681177037ef 105 void drawHomeButtons();
el17cd 31:e681177037ef 106 /** @brief Draws the home menus buttons
el17cd 31:e681177037ef 107 */
el17cd 31:e681177037ef 108 void drawSelectionCube(int x, int y, int z, int rotationSpeed);
el17cd 31:e681177037ef 109 /** @brief Draws the cube which indicates the selected button on the menus
el17cd 31:e681177037ef 110 *@param The x coordinate of where to draw the cube as an integer
el17cd 31:e681177037ef 111 *@param The y coordinate of where to draw the cube as an integer
el17cd 31:e681177037ef 112 *@param The z coordinate of where to draw the cube as an integer
el17cd 31:e681177037ef 113 *@param The rotation speed multiplier of the cube as an integer
el17cd 31:e681177037ef 114 */
el17cd 31:e681177037ef 115 void drawHelpScreen1();
el17cd 31:e681177037ef 116 /** @brief Draws the first help screen
el17cd 31:e681177037ef 117 */
el17cd 31:e681177037ef 118 void drawHelpScreen2();
el17cd 31:e681177037ef 119 /** @brief Draws the second help screen
el17cd 31:e681177037ef 120 */
el17cd 31:e681177037ef 121 void drawHelpScreen3();
el17cd 31:e681177037ef 122 /** @brief Draws the third help screen
el17cd 31:e681177037ef 123 */
el17cd 31:e681177037ef 124 void drawHelpScreen4();
el17cd 31:e681177037ef 125 /** @brief Draws the fourth help screen
el17cd 31:e681177037ef 126 */
el17cd 31:e681177037ef 127 };
el17cd 31:e681177037ef 128