Joshua O'hara 201291390

Dependencies:   mbed

Committer:
josh_ohara
Date:
Tue May 26 15:15:46 2020 +0000
Revision:
44:3b904d25ee12
Parent:
39:5d4277548303
Final Submission. I have read and agreed with Statement of Academic Integrity.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
josh_ohara 15:dde4ce4bf7fe 1 #include "mbed.h"
josh_ohara 15:dde4ce4bf7fe 2 #include "N5110.h"
josh_ohara 15:dde4ce4bf7fe 3 #include "Gamepad.h"
josh_ohara 15:dde4ce4bf7fe 4 #include "Rock.h"
josh_ohara 15:dde4ce4bf7fe 5 #include <vector>
josh_ohara 15:dde4ce4bf7fe 6
josh_ohara 38:6f50b548226e 7 /** Cover Class
josh_ohara 38:6f50b548226e 8 @author Joshua Ohara, el18jkeo, 201291390
josh_ohara 38:6f50b548226e 9 @brief Controls and creates the cover which is a vector of rocks
josh_ohara 38:6f50b548226e 10 @date May 2020
josh_ohara 38:6f50b548226e 11 */
josh_ohara 38:6f50b548226e 12
josh_ohara 15:dde4ce4bf7fe 13 class Cover
josh_ohara 15:dde4ce4bf7fe 14 {
josh_ohara 15:dde4ce4bf7fe 15 public:
josh_ohara 38:6f50b548226e 16
josh_ohara 38:6f50b548226e 17 /**Constructor*/
josh_ohara 15:dde4ce4bf7fe 18 Cover();
josh_ohara 38:6f50b548226e 19
josh_ohara 38:6f50b548226e 20 /**Destructor*/
josh_ohara 15:dde4ce4bf7fe 21 ~Cover();
josh_ohara 38:6f50b548226e 22
josh_ohara 38:6f50b548226e 23 /**Sets starting private variables and creates vector of rocks*/
josh_ohara 31:27c938ec2a11 24 void init(int x, int y, int no_rocks); //initialise cover object (vector of rocks) and set private variables
josh_ohara 38:6f50b548226e 25
josh_ohara 38:6f50b548226e 26 /**Creates the vector of rocks*/
josh_ohara 31:27c938ec2a11 27 void create_cover(); //function to create the vector of rocks
josh_ohara 38:6f50b548226e 28
josh_ohara 38:6f50b548226e 29 /**Iterates through vector and draws each rock*/
josh_ohara 31:27c938ec2a11 30 void render(N5110 &lcd); //draw the rocks in the cover
josh_ohara 39:5d4277548303 31
josh_ohara 39:5d4277548303 32 //accessors and mutators//
josh_ohara 38:6f50b548226e 33
josh_ohara 39:5d4277548303 34 /**Returns a copy of the vector of rocks
josh_ohara 39:5d4277548303 35 *@return _alien_cover (vector<Rock>)
josh_ohara 39:5d4277548303 36 */
josh_ohara 31:27c938ec2a11 37 vector<Rock> get_vector(); //return a copy of the vector of rocks
josh_ohara 39:5d4277548303 38
josh_ohara 39:5d4277548303 39 /**Sets the life value of rock i in the vector of rocks
josh_ohara 39:5d4277548303 40 *@param rock life (bool)
josh_ohara 39:5d4277548303 41 */
josh_ohara 31:27c938ec2a11 42 void set_life(int i, bool x); //set the life of rock i in the vector
josh_ohara 39:5d4277548303 43
josh_ohara 39:5d4277548303 44 /**Returns the life value of rock i in the vector of rocks
josh_ohara 39:5d4277548303 45 *@return rock life (bool)
josh_ohara 39:5d4277548303 46 */
josh_ohara 31:27c938ec2a11 47 bool get_life(int i); //return the life of rock i in the vector
josh_ohara 15:dde4ce4bf7fe 48
josh_ohara 15:dde4ce4bf7fe 49 private:
josh_ohara 31:27c938ec2a11 50 int _x;
josh_ohara 31:27c938ec2a11 51 int _y;
josh_ohara 31:27c938ec2a11 52 int _rock_number;
josh_ohara 31:27c938ec2a11 53 int _row_size;
josh_ohara 31:27c938ec2a11 54 int _spacing;
josh_ohara 31:27c938ec2a11 55 vector<Rock> _alien_cover;
josh_ohara 15:dde4ce4bf7fe 56 };