Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Cricket/Cricket.h
- Committer:
- shahidsajid
- Date:
- 2019-04-30
- Revision:
- 22:69d7fe739872
- Parent:
- 21:a0904159e183
File content as of revision 22:69d7fe739872:
#ifndef CRICKET_H #define CRICKET_H #include "mbed.h" #include "N5110.h" #include "Gamepad.h" #include "Ball.h" #include "Scoreboard.h" #include "UX.h" /** Ball Class @author Dr Craig A. Evans, University of Leeds @brief Controls the ball in the Pong game @date Febraury 2017 */ class Cricket { public: Cricket(); ~Cricket(); void init(); void draw(N5110 &lcd); void set_field(N5110 &lcd); void set_init_positions(int x,int y, Direction direction,int no); void set_ball_direction(Direction dir); void draw_field(N5110 &lcd); void update_game(int checkHit,int loft_check, Direction dir,Gamepad &pad,N5110 &lcd); void play_game(N5110 &lcd,Gamepad &pad); void update_scoreboard(int checkUpdate, int runs,Gamepad &pad); void batsman_out(int option,Gamepad &pad, N5110 &lcd); void check_victory(N5110 &lcd); void game(N5110 &lcd,Gamepad &pad); void new_round(N5110 &lcd, Gamepad &pad); void new_game(N5110 &lcd, Gamepad &pad); void intro(N5110 &lcd); void init_positions(); void round_reset(); void game_reset(); int check_fielder(Direction dir); bool check_ball_count(N5110 &lcd); private: Ball ball; Bat bat; Scoreboard scoreboard; UX ux; struct fielder_positions{ Direction dir; int x; int y; int no; }; fielder_positions positions[7]; struct Fielder{ Direction dir; int x; int y; int position; }; Fielder field[5]; int direction_set; Vector2D ball_position; Direction ball_direction; int check_bowled; int init_field_counter; int outfield_fielder; int fieldersCount; int _new_round; int fieldNumbers[10]; int _position_no; int ballHit; int check_hit; int _ball_limit; int _new_game; int check_update; int set_hit; int set_loft; int loft_check; int d; int _size; int _x; int _y; }; #endif