ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Committer:
shahidsajid
Date:
Wed May 08 01:20:06 2019 +0000
Revision:
30:43aace0fdbdf
Parent:
29:f7a2d2a755ec
Child:
31:eefa1d23a843
Updated in-line comments for 3 classes;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shahidsajid 30:43aace0fdbdf 1
shahidsajid 30:43aace0fdbdf 2
shahidsajid 4:55a0509c4874 3 #ifndef BAT_H
shahidsajid 4:55a0509c4874 4 #define BAT_H
shahidsajid 4:55a0509c4874 5
shahidsajid 4:55a0509c4874 6 #include "mbed.h"
shahidsajid 4:55a0509c4874 7 #include "N5110.h"
shahidsajid 4:55a0509c4874 8 #include "Gamepad.h"
shahidsajid 21:a0904159e183 9 #include "UX.h"
shahidsajid 4:55a0509c4874 10
shahidsajid 26:6427f09cf8d3 11 /** Bat Class
shahidsajid 26:6427f09cf8d3 12 @author Shahid Zubin Sajid,
shahidsajid 30:43aace0fdbdf 13 @brief Bat charactersitics and checks for collisions
shahidsajid 4:55a0509c4874 14 @date Febraury 2017
shahidsajid 30:43aace0fdbdf 15 */
shahidsajid 4:55a0509c4874 16 class Bat
shahidsajid 4:55a0509c4874 17 {
shahidsajid 4:55a0509c4874 18
shahidsajid 4:55a0509c4874 19 public:
shahidsajid 30:43aace0fdbdf 20 /**
shahidsajid 29:f7a2d2a755ec 21 * @brief Constructor for the Bat Class
shahidsajid 29:f7a2d2a755ec 22 */
shahidsajid 4:55a0509c4874 23 Bat();
shahidsajid 30:43aace0fdbdf 24 /**
shahidsajid 29:f7a2d2a755ec 25 * @brief Deconstructor for the Bat Class
shahidsajid 29:f7a2d2a755ec 26 */
shahidsajid 4:55a0509c4874 27 ~Bat();
shahidsajid 30:43aace0fdbdf 28 /**
shahidsajid 28:d0b0a64a832d 29 * @brief Initlialises the Bat class
shahidsajid 28:d0b0a64a832d 30 * @details Sets the Bat's position and sets the batting variables to 0
shahidsajid 28:d0b0a64a832d 31 */
shahidsajid 4:55a0509c4874 32 void init(int x,int y);
shahidsajid 30:43aace0fdbdf 33 /**
shahidsajid 28:d0b0a64a832d 34 * @brief Prints the bat to the LCD at the inititialised co-ordinates
shahidsajid 28:d0b0a64a832d 35 * @param &lcd @details reference object for a N5110 class object
shahidsajid 28:d0b0a64a832d 36 */
shahidsajid 4:55a0509c4874 37 void draw(N5110 &lcd);
shahidsajid 30:43aace0fdbdf 38 /**
shahidsajid 28:d0b0a64a832d 39 * @brief Resets the batting variables to 0
shahidsajid 28:d0b0a64a832d 40 * param &lcd @details reference pointer for the LCD
shahidsajid 28:d0b0a64a832d 41 */
shahidsajid 26:6427f09cf8d3 42 void reset();
shahidsajid 30:43aace0fdbdf 43
shahidsajid 28:d0b0a64a832d 44 //accessors and mutators
shahidsajid 30:43aace0fdbdf 45 /**
shahidsajid 28:d0b0a64a832d 46 * @brief Checks if the ball has been hit with the bat during each round
shahidsajid 28:d0b0a64a832d 47 * @param @ux @details takes a UserExperience object to check if Button A has been pressed
shahidsajid 28:d0b0a64a832d 48 * @returns a boolean value true if ball has been hit during the round and false if ball was missed
shahidsajid 28:d0b0a64a832d 49 */
shahidsajid 21:a0904159e183 50 int get_hitBall(UX &ux);
shahidsajid 30:43aace0fdbdf 51 /**
shahidsajid 28:d0b0a64a832d 52 * @brief Checks if the hit was a lofted hit
shahidsajid 28:d0b0a64a832d 53 * @param @ux @details takes a UserExperience object to check if Button L has been pressed
shahidsajid 28:d0b0a64a832d 54 * @returns a boolean value true if button L is pressed during the round and false if button L is not pressed
shahidsajid 28:d0b0a64a832d 55 */
shahidsajid 21:a0904159e183 56 int get_loft_ball(UX &ux);
shahidsajid 30:43aace0fdbdf 57
shahidsajid 30:43aace0fdbdf 58
shahidsajid 4:55a0509c4874 59 private:
shahidsajid 29:f7a2d2a755ec 60
shahidsajid 29:f7a2d2a755ec 61 /*integer variable used to check if ball is Hit, the variable is essentially used as a flag
shahidsajid 29:f7a2d2a755ec 62 in the cricket method*/
shahidsajid 6:3e50f2cf4366 63 int _hitBall;
shahidsajid 30:43aace0fdbdf 64
shahidsajid 29:f7a2d2a755ec 65 /*integer variable used to check if the hit is lofted, the variable is essentially used as a flag
shahidsajid 29:f7a2d2a755ec 66 in the cricket class */
shahidsajid 13:924891519a95 67 int _loft_ball;
shahidsajid 30:43aace0fdbdf 68
shahidsajid 28:d0b0a64a832d 69 //Direction of the ball
shahidsajid 4:55a0509c4874 70 int d;
shahidsajid 30:43aace0fdbdf 71
shahidsajid 28:d0b0a64a832d 72 //x co-ordinate for the bat to be printed on the LCD
shahidsajid 26:6427f09cf8d3 73 int _bat_x;
shahidsajid 28:d0b0a64a832d 74 //y co-ordinate for the bat to be printed on the LCD
shahidsajid 26:6427f09cf8d3 75 int _bat_y;
shahidsajid 4:55a0509c4874 76 };
shahidsajid 30:43aace0fdbdf 77 #endif