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
Bat/Bat.cpp@26:6427f09cf8d3, 2019-05-01 (annotated)
- Committer:
- shahidsajid
- Date:
- Wed May 01 11:56:36 2019 +0000
- Revision:
- 26:6427f09cf8d3
- Parent:
- 24:23fd6b451db7
- Child:
- 28:d0b0a64a832d
Documented the UX class
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| shahidsajid | 4:55a0509c4874 | 1 | #include "Bat.h" |
| shahidsajid | 4:55a0509c4874 | 2 | |
| shahidsajid | 4:55a0509c4874 | 3 | |
| shahidsajid | 4:55a0509c4874 | 4 | Bat::Bat() |
| shahidsajid | 4:55a0509c4874 | 5 | { |
| shahidsajid | 4:55a0509c4874 | 6 | |
| shahidsajid | 4:55a0509c4874 | 7 | } |
| shahidsajid | 4:55a0509c4874 | 8 | |
| shahidsajid | 4:55a0509c4874 | 9 | Bat::~Bat() |
| shahidsajid | 4:55a0509c4874 | 10 | { |
| shahidsajid | 4:55a0509c4874 | 11 | |
| shahidsajid | 4:55a0509c4874 | 12 | } |
| shahidsajid | 4:55a0509c4874 | 13 | void Bat::init(int x,int y) |
| shahidsajid | 6:3e50f2cf4366 | 14 | { |
| shahidsajid | 6:3e50f2cf4366 | 15 | batPad.init(); |
| shahidsajid | 26:6427f09cf8d3 | 16 | _bat_x = 42; |
| shahidsajid | 26:6427f09cf8d3 | 17 | _bat_y = 15; |
| shahidsajid | 6:3e50f2cf4366 | 18 | _hitBall=0; |
| shahidsajid | 21:a0904159e183 | 19 | |
| shahidsajid | 4:55a0509c4874 | 20 | } |
| shahidsajid | 13:924891519a95 | 21 | void Bat::reset(){ |
| shahidsajid | 13:924891519a95 | 22 | _hitBall=0; |
| shahidsajid | 13:924891519a95 | 23 | _loft_ball=0; |
| shahidsajid | 13:924891519a95 | 24 | } |
| shahidsajid | 4:55a0509c4874 | 25 | void Bat::draw(N5110 &lcd){ |
| shahidsajid | 4:55a0509c4874 | 26 | lcd.drawLine(38,36,41,36,1); |
| shahidsajid | 4:55a0509c4874 | 27 | lcd.drawRect(41,35,6,3,FILL_BLACK); |
| shahidsajid | 4:55a0509c4874 | 28 | } |
| shahidsajid | 21:a0904159e183 | 29 | int Bat::get_hitBall(UX &ux){ |
| shahidsajid | 21:a0904159e183 | 30 | _hitBall=ux.get_a_pressed(); |
| shahidsajid | 21:a0904159e183 | 31 | printf("_hitBall %i \n",_hitBall); |
| shahidsajid | 6:3e50f2cf4366 | 32 | return _hitBall; |
| shahidsajid | 6:3e50f2cf4366 | 33 | } |
| shahidsajid | 21:a0904159e183 | 34 | int Bat::get_loft_ball(UX &ux){ |
| shahidsajid | 24:23fd6b451db7 | 35 | _loft_ball=ux.get_l_pressed(); |
| shahidsajid | 13:924891519a95 | 36 | return _loft_ball; |
| shahidsajid | 21:a0904159e183 | 37 | } |