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
Ball/Ball.h@26:6427f09cf8d3, 2019-05-01 (annotated)
- Committer:
- shahidsajid
- Date:
- Wed May 01 11:56:36 2019 +0000
- Revision:
- 26:6427f09cf8d3
- Parent:
- 20:9d21599fe350
- Child:
- 28:d0b0a64a832d
Documented the UX class
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shahidsajid | 3:bd3465a70a5a | 1 | #ifndef BALL_H |
shahidsajid | 3:bd3465a70a5a | 2 | #define BALL_H |
shahidsajid | 3:bd3465a70a5a | 3 | |
shahidsajid | 3:bd3465a70a5a | 4 | #include "mbed.h" |
shahidsajid | 3:bd3465a70a5a | 5 | #include "N5110.h" |
shahidsajid | 3:bd3465a70a5a | 6 | #include "Gamepad.h" |
shahidsajid | 6:3e50f2cf4366 | 7 | #include "Bat.h" |
shahidsajid | 3:bd3465a70a5a | 8 | /** Ball Class |
shahidsajid | 26:6427f09cf8d3 | 9 | @author Shahid Zubin Sajid |
shahidsajid | 26:6427f09cf8d3 | 10 | @brief Controls the ball in the Hero Cricket Game |
shahidsajid | 26:6427f09cf8d3 | 11 | @date May 2019 |
shahidsajid | 3:bd3465a70a5a | 12 | */ |
shahidsajid | 3:bd3465a70a5a | 13 | class Ball |
shahidsajid | 3:bd3465a70a5a | 14 | { |
shahidsajid | 3:bd3465a70a5a | 15 | |
shahidsajid | 3:bd3465a70a5a | 16 | public: |
shahidsajid | 3:bd3465a70a5a | 17 | Ball(); |
shahidsajid | 3:bd3465a70a5a | 18 | ~Ball(); |
shahidsajid | 3:bd3465a70a5a | 19 | void init(int size,int speed); |
shahidsajid | 3:bd3465a70a5a | 20 | void draw(N5110 &lcd); |
shahidsajid | 13:924891519a95 | 21 | void reset(); |
shahidsajid | 26:6427f09cf8d3 | 22 | void reset_ball_count(); |
shahidsajid | 10:6c6e09023942 | 23 | |
shahidsajid | 10:6c6e09023942 | 24 | /// accessors and mutators |
shahidsajid | 15:81a3aaf52647 | 25 | int ball_start(Gamepad &pad); |
shahidsajid | 3:bd3465a70a5a | 26 | void get_direction(Gamepad &pad); |
shahidsajid | 18:a260ce8db9e7 | 27 | int get_ball_count(); |
shahidsajid | 10:6c6e09023942 | 28 | |
shahidsajid | 12:954da4f4e565 | 29 | //void update_ball(int checkHit, Direction dir); |
shahidsajid | 14:122eaa3b7a50 | 30 | int update_ball(int expected_x,int expected_y); |
shahidsajid | 15:81a3aaf52647 | 31 | int bowler_start(Gamepad &pad); |
shahidsajid | 18:a260ce8db9e7 | 32 | void increment_ball_count(); |
shahidsajid | 3:bd3465a70a5a | 33 | |
shahidsajid | 3:bd3465a70a5a | 34 | private: |
shahidsajid | 4:55a0509c4874 | 35 | struct Fielder{ |
shahidsajid | 10:6c6e09023942 | 36 | Direction dir; |
shahidsajid | 4:55a0509c4874 | 37 | int x; |
shahidsajid | 4:55a0509c4874 | 38 | int y; |
shahidsajid | 4:55a0509c4874 | 39 | int position; |
shahidsajid | 4:55a0509c4874 | 40 | }; |
shahidsajid | 9:a81db6a703b7 | 41 | int fieldNumbers[10]; |
shahidsajid | 6:3e50f2cf4366 | 42 | Bat bat; |
shahidsajid | 18:a260ce8db9e7 | 43 | int _ball_count; |
shahidsajid | 26:6427f09cf8d3 | 44 | int _bowled; |
shahidsajid | 26:6427f09cf8d3 | 45 | int _set_tone; |
shahidsajid | 4:55a0509c4874 | 46 | int d; |
shahidsajid | 3:bd3465a70a5a | 47 | int _size; |
shahidsajid | 3:bd3465a70a5a | 48 | int _x; |
shahidsajid | 3:bd3465a70a5a | 49 | int _y; |
shahidsajid | 7:a1a6bff238c1 | 50 | int _x1; |
shahidsajid | 7:a1a6bff238c1 | 51 | int _y1; |
shahidsajid | 3:bd3465a70a5a | 52 | }; |
shahidsajid | 3:bd3465a70a5a | 53 | #endif |