ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Committer:
shahidsajid
Date:
Tue Apr 30 13:17:14 2019 +0000
Revision:
21:a0904159e183
Parent:
20:9d21599fe350
Child:
22:69d7fe739872
Child:
24:23fd6b451db7
Created text for the rules and controls menus;

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 19:e1ded5acb64a 34
shahidsajid 12:954da4f4e565 35 void init_positions();
shahidsajid 19:e1ded5acb64a 36 void round_reset();
shahidsajid 19:e1ded5acb64a 37 void game_reset();
shahidsajid 13:924891519a95 38 int check_fielder(Direction dir);
shahidsajid 19:e1ded5acb64a 39 bool check_ball_count(N5110 &lcd);
shahidsajid 10:6c6e09023942 40 private:
shahidsajid 10:6c6e09023942 41 Ball ball;
shahidsajid 10:6c6e09023942 42 Bat bat;
shahidsajid 14:122eaa3b7a50 43 Scoreboard scoreboard;
shahidsajid 21:a0904159e183 44 UX ux;
shahidsajid 12:954da4f4e565 45
shahidsajid 12:954da4f4e565 46 struct fielder_positions{
shahidsajid 12:954da4f4e565 47 Direction dir;
shahidsajid 12:954da4f4e565 48 int x;
shahidsajid 12:954da4f4e565 49 int y;
shahidsajid 12:954da4f4e565 50 int no;
shahidsajid 12:954da4f4e565 51 };
shahidsajid 12:954da4f4e565 52 fielder_positions positions[7];
shahidsajid 10:6c6e09023942 53 struct Fielder{
shahidsajid 10:6c6e09023942 54 Direction dir;
shahidsajid 10:6c6e09023942 55 int x;
shahidsajid 10:6c6e09023942 56 int y;
shahidsajid 10:6c6e09023942 57 int position;
shahidsajid 10:6c6e09023942 58 };
shahidsajid 10:6c6e09023942 59 Fielder field[5];
shahidsajid 10:6c6e09023942 60 int direction_set;
shahidsajid 10:6c6e09023942 61 Vector2D ball_position;
shahidsajid 12:954da4f4e565 62 Direction ball_direction;
shahidsajid 12:954da4f4e565 63 int check_bowled;
shahidsajid 12:954da4f4e565 64 int init_field_counter;
shahidsajid 13:924891519a95 65 int outfield_fielder;
shahidsajid 12:954da4f4e565 66 int fieldersCount;
shahidsajid 10:6c6e09023942 67 int new_round;
shahidsajid 10:6c6e09023942 68 int fieldNumbers[10];
shahidsajid 20:9d21599fe350 69 int _position_no;
shahidsajid 10:6c6e09023942 70 int ballHit;
shahidsajid 15:81a3aaf52647 71 int check_hit;
shahidsajid 18:a260ce8db9e7 72 int _ball_limit;
shahidsajid 18:a260ce8db9e7 73 int new_game;
shahidsajid 15:81a3aaf52647 74 int check_update;
shahidsajid 21:a0904159e183 75 int set_hit;
shahidsajid 15:81a3aaf52647 76 int loft_check;
shahidsajid 10:6c6e09023942 77 int d;
shahidsajid 10:6c6e09023942 78 int _size;
shahidsajid 10:6c6e09023942 79 int _x;
shahidsajid 10:6c6e09023942 80 int _y;
shahidsajid 10:6c6e09023942 81 };
shahidsajid 10:6c6e09023942 82 #endif