ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Committer:
shahidsajid
Date:
Wed May 01 08:46:44 2019 +0000
Revision:
24:23fd6b451db7
Parent:
21:a0904159e183
Child:
26:6427f09cf8d3
Fixed menu bugs

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 21:a0904159e183 9 #include "UX.h"
shahidsajid 10:6c6e09023942 10
shahidsajid 10:6c6e09023942 11 /** Ball Class
shahidsajid 10:6c6e09023942 12 @author Dr Craig A. Evans, University of Leeds
shahidsajid 10:6c6e09023942 13 @brief Controls the ball in the Pong game
shahidsajid 10:6c6e09023942 14 @date Febraury 2017
shahidsajid 10:6c6e09023942 15 */
shahidsajid 10:6c6e09023942 16 class Cricket
shahidsajid 10:6c6e09023942 17 {
shahidsajid 10:6c6e09023942 18
shahidsajid 10:6c6e09023942 19 public:
shahidsajid 10:6c6e09023942 20 Cricket();
shahidsajid 10:6c6e09023942 21 ~Cricket();
shahidsajid 10:6c6e09023942 22 void init();
shahidsajid 10:6c6e09023942 23 void draw(N5110 &lcd);
shahidsajid 10:6c6e09023942 24 void set_field(N5110 &lcd);
shahidsajid 13:924891519a95 25 void set_init_positions(int x,int y, Direction direction,int no);
shahidsajid 13:924891519a95 26 void set_ball_direction(Direction dir);
shahidsajid 10:6c6e09023942 27 void draw_field(N5110 &lcd);
shahidsajid 19:e1ded5acb64a 28 void update_game(int checkHit,int loft_check, Direction dir,Gamepad &pad,N5110 &lcd);
shahidsajid 11:f481ec642cc5 29 void play_game(N5110 &lcd,Gamepad &pad);
shahidsajid 15:81a3aaf52647 30 void update_scoreboard(int checkUpdate, int runs,Gamepad &pad);
shahidsajid 19:e1ded5acb64a 31 void batsman_out(int option,Gamepad &pad, N5110 &lcd);
shahidsajid 18:a260ce8db9e7 32 void check_victory(N5110 &lcd);
shahidsajid 19:e1ded5acb64a 33 void game(N5110 &lcd,Gamepad &pad);
shahidsajid 24:23fd6b451db7 34 void intro(N5110 &lcd);
shahidsajid 24:23fd6b451db7 35 bool game_status(N5110 &lcd);
shahidsajid 24:23fd6b451db7 36 void info_screen(N5110 &lcd, int target);
shahidsajid 19:e1ded5acb64a 37
shahidsajid 12:954da4f4e565 38 void init_positions();
shahidsajid 19:e1ded5acb64a 39 void round_reset();
shahidsajid 19:e1ded5acb64a 40 void game_reset();
shahidsajid 13:924891519a95 41 int check_fielder(Direction dir);
shahidsajid 19:e1ded5acb64a 42 bool check_ball_count(N5110 &lcd);
shahidsajid 10:6c6e09023942 43 private:
shahidsajid 10:6c6e09023942 44 Ball ball;
shahidsajid 10:6c6e09023942 45 Bat bat;
shahidsajid 14:122eaa3b7a50 46 Scoreboard scoreboard;
shahidsajid 21:a0904159e183 47 UX ux;
shahidsajid 12:954da4f4e565 48
shahidsajid 12:954da4f4e565 49 struct fielder_positions{
shahidsajid 12:954da4f4e565 50 Direction dir;
shahidsajid 12:954da4f4e565 51 int x;
shahidsajid 12:954da4f4e565 52 int y;
shahidsajid 12:954da4f4e565 53 int no;
shahidsajid 12:954da4f4e565 54 };
shahidsajid 12:954da4f4e565 55 fielder_positions positions[7];
shahidsajid 10:6c6e09023942 56 struct Fielder{
shahidsajid 10:6c6e09023942 57 Direction dir;
shahidsajid 10:6c6e09023942 58 int x;
shahidsajid 10:6c6e09023942 59 int y;
shahidsajid 10:6c6e09023942 60 int position;
shahidsajid 10:6c6e09023942 61 };
shahidsajid 10:6c6e09023942 62 Fielder field[5];
shahidsajid 10:6c6e09023942 63 int direction_set;
shahidsajid 10:6c6e09023942 64 Vector2D ball_position;
shahidsajid 12:954da4f4e565 65 Direction ball_direction;
shahidsajid 12:954da4f4e565 66 int check_bowled;
shahidsajid 12:954da4f4e565 67 int init_field_counter;
shahidsajid 13:924891519a95 68 int outfield_fielder;
shahidsajid 12:954da4f4e565 69 int fieldersCount;
shahidsajid 10:6c6e09023942 70 int new_round;
shahidsajid 10:6c6e09023942 71 int fieldNumbers[10];
shahidsajid 20:9d21599fe350 72 int _position_no;
shahidsajid 10:6c6e09023942 73 int ballHit;
shahidsajid 15:81a3aaf52647 74 int check_hit;
shahidsajid 18:a260ce8db9e7 75 int _ball_limit;
shahidsajid 18:a260ce8db9e7 76 int new_game;
shahidsajid 15:81a3aaf52647 77 int check_update;
shahidsajid 21:a0904159e183 78 int set_hit;
shahidsajid 24:23fd6b451db7 79 int set_loft;
shahidsajid 15:81a3aaf52647 80 int loft_check;
shahidsajid 10:6c6e09023942 81 int d;
shahidsajid 10:6c6e09023942 82 int _size;
shahidsajid 10:6c6e09023942 83 int _x;
shahidsajid 10:6c6e09023942 84 int _y;
shahidsajid 10:6c6e09023942 85 };
shahidsajid 10:6c6e09023942 86 #endif