ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Committer:
shahidsajid
Date:
Wed Apr 24 21:17:22 2019 +0000
Revision:
15:81a3aaf52647
Parent:
14:122eaa3b7a50
Child:
17:b2b651acffae
Child:
18:a260ce8db9e7
Created a few starting menus; Created a tone for when bowler starts and batsman is out

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shahidsajid 10:6c6e09023942 1 #ifndef CRICKET_H
shahidsajid 10:6c6e09023942 2 #define CRICKET_H
shahidsajid 10:6c6e09023942 3
shahidsajid 10:6c6e09023942 4 #include "mbed.h"
shahidsajid 10:6c6e09023942 5 #include "N5110.h"
shahidsajid 10:6c6e09023942 6 #include "Gamepad.h"
shahidsajid 10:6c6e09023942 7 #include "Ball.h"
shahidsajid 14:122eaa3b7a50 8 #include "Scoreboard.h"
shahidsajid 10:6c6e09023942 9
shahidsajid 10:6c6e09023942 10 /** Ball Class
shahidsajid 10:6c6e09023942 11 @author Dr Craig A. Evans, University of Leeds
shahidsajid 10:6c6e09023942 12 @brief Controls the ball in the Pong game
shahidsajid 10:6c6e09023942 13 @date Febraury 2017
shahidsajid 10:6c6e09023942 14 */
shahidsajid 10:6c6e09023942 15 class Cricket
shahidsajid 10:6c6e09023942 16 {
shahidsajid 10:6c6e09023942 17
shahidsajid 10:6c6e09023942 18 public:
shahidsajid 10:6c6e09023942 19 Cricket();
shahidsajid 10:6c6e09023942 20 ~Cricket();
shahidsajid 10:6c6e09023942 21 void init();
shahidsajid 10:6c6e09023942 22 void draw(N5110 &lcd);
shahidsajid 10:6c6e09023942 23 void set_field(N5110 &lcd);
shahidsajid 13:924891519a95 24 void set_init_positions(int x,int y, Direction direction,int no);
shahidsajid 13:924891519a95 25 void set_ball_direction(Direction dir);
shahidsajid 10:6c6e09023942 26 void draw_field(N5110 &lcd);
shahidsajid 15:81a3aaf52647 27 void update_game(int checkHit,int loft_check, Direction dir,Gamepad &pad);
shahidsajid 11:f481ec642cc5 28 void play_game(N5110 &lcd,Gamepad &pad);
shahidsajid 15:81a3aaf52647 29 void update_scoreboard(int checkUpdate, int runs,Gamepad &pad);
shahidsajid 15:81a3aaf52647 30 void batsman_out(string messsage,Gamepad &pad);
shahidsajid 12:954da4f4e565 31 void game(N5110 &lcd,Gamepad &pad);
shahidsajid 12:954da4f4e565 32 void init_positions();
shahidsajid 13:924891519a95 33 void reset();
shahidsajid 13:924891519a95 34 int check_fielder(Direction dir);
shahidsajid 10:6c6e09023942 35 private:
shahidsajid 10:6c6e09023942 36 Ball ball;
shahidsajid 10:6c6e09023942 37 Bat bat;
shahidsajid 14:122eaa3b7a50 38 Scoreboard scoreboard;
shahidsajid 12:954da4f4e565 39
shahidsajid 12:954da4f4e565 40 struct fielder_positions{
shahidsajid 12:954da4f4e565 41 Direction dir;
shahidsajid 12:954da4f4e565 42 int x;
shahidsajid 12:954da4f4e565 43 int y;
shahidsajid 12:954da4f4e565 44 int no;
shahidsajid 12:954da4f4e565 45 };
shahidsajid 12:954da4f4e565 46 fielder_positions positions[7];
shahidsajid 10:6c6e09023942 47 struct Fielder{
shahidsajid 10:6c6e09023942 48 Direction dir;
shahidsajid 10:6c6e09023942 49 int x;
shahidsajid 10:6c6e09023942 50 int y;
shahidsajid 10:6c6e09023942 51 int position;
shahidsajid 10:6c6e09023942 52 };
shahidsajid 10:6c6e09023942 53 Fielder field[5];
shahidsajid 10:6c6e09023942 54 int direction_set;
shahidsajid 10:6c6e09023942 55 Vector2D ball_position;
shahidsajid 12:954da4f4e565 56 Direction ball_direction;
shahidsajid 12:954da4f4e565 57 int check_bowled;
shahidsajid 12:954da4f4e565 58 int init_field_counter;
shahidsajid 13:924891519a95 59 int outfield_fielder;
shahidsajid 12:954da4f4e565 60 int fieldersCount;
shahidsajid 10:6c6e09023942 61 int new_round;
shahidsajid 10:6c6e09023942 62 int fieldNumbers[10];
shahidsajid 12:954da4f4e565 63 int fielder_no;
shahidsajid 10:6c6e09023942 64 int ballHit;
shahidsajid 15:81a3aaf52647 65 int check_hit;
shahidsajid 15:81a3aaf52647 66 int check_update;
shahidsajid 15:81a3aaf52647 67 int loft_check;
shahidsajid 10:6c6e09023942 68 int d;
shahidsajid 10:6c6e09023942 69 int _size;
shahidsajid 10:6c6e09023942 70 int _x;
shahidsajid 10:6c6e09023942 71 int _y;
shahidsajid 10:6c6e09023942 72 };
shahidsajid 10:6c6e09023942 73 #endif