ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Cricket/Cricket.h

Committer:
shahidsajid
Date:
2019-04-23
Revision:
13:924891519a95
Parent:
12:954da4f4e565
Child:
14:122eaa3b7a50

File content as of revision 13:924891519a95:

#ifndef CRICKET_H
#define CRICKET_H

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Ball.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);
    void play_game(N5110 &lcd,Gamepad &pad);
    void game(N5110 &lcd,Gamepad &pad);   
    void init_positions();
    void reset();
    int check_fielder(Direction dir);
private:
    Ball ball;
    Bat bat;
    
    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 d;
    int _size;
    int _x;
    int _y;
};
#endif