ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Cricket/Cricket.h

Committer:
shahidsajid
Date:
2019-04-24
Revision:
15:81a3aaf52647
Parent:
14:122eaa3b7a50
Child:
17:b2b651acffae
Child:
18:a260ce8db9e7

File content as of revision 15:81a3aaf52647:

#ifndef CRICKET_H
#define CRICKET_H

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Ball.h"
#include "Scoreboard.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);
    void play_game(N5110 &lcd,Gamepad &pad);
    void update_scoreboard(int checkUpdate, int runs,Gamepad &pad);
    void batsman_out(string messsage,Gamepad &pad);
    void game(N5110 &lcd,Gamepad &pad);   
    void init_positions();
    void reset();
    int check_fielder(Direction dir);
private:
    Ball ball;
    Bat bat;
    Scoreboard scoreboard;
    
    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 fielder_no;
    int ballHit;
    int check_hit;
    int check_update;
    int loft_check;
    int d;
    int _size;
    int _x;
    int _y;
};
#endif