Class containing methods to draw a ball within the maze game with the specified position, size and fill style parameters.
Ball.h@2:bcb96ab2848b, 2017-05-03 (annotated)
- Committer:
- el15mh
- Date:
- Wed May 03 21:13:45 2017 +0000
- Revision:
- 2:bcb96ab2848b
- Parent:
- 1:ba8bb10ebd5a
- Child:
- 3:569a3f2786ec
fully working program
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el15mh | 2:bcb96ab2848b | 1 | /* |
el15mh | 2:bcb96ab2848b | 2 | |
el15mh | 2:bcb96ab2848b | 3 | @file Ball.h |
el15mh | 2:bcb96ab2848b | 4 | |
el15mh | 2:bcb96ab2848b | 5 | (c) Max Houghton 02.14.17 |
el15mh | 2:bcb96ab2848b | 6 | Roller Maze Project, ELEC2645, Univeristy of Leeds |
el15mh | 2:bcb96ab2848b | 7 | |
el15mh | 2:bcb96ab2848b | 8 | */ |
el15mh | 2:bcb96ab2848b | 9 | |
el15mh | 0:4c58ed26b6ea | 10 | // |
el15mh | 0:4c58ed26b6ea | 11 | // ball.h |
el15mh | 1:ba8bb10ebd5a | 12 | // |
el15mh | 0:4c58ed26b6ea | 13 | // |
el15mh | 0:4c58ed26b6ea | 14 | // Created by Max Houghton on 19/03/2017. |
el15mh | 0:4c58ed26b6ea | 15 | // |
el15mh | 0:4c58ed26b6ea | 16 | // |
el15mh | 0:4c58ed26b6ea | 17 | |
el15mh | 0:4c58ed26b6ea | 18 | #ifndef BALL_H |
el15mh | 0:4c58ed26b6ea | 19 | #define BALL_H |
el15mh | 0:4c58ed26b6ea | 20 | |
el15mh | 0:4c58ed26b6ea | 21 | #include "mbed.h" |
el15mh | 0:4c58ed26b6ea | 22 | #include "N5110.h" |
el15mh | 0:4c58ed26b6ea | 23 | #include "Gamepad.h" |
el15mh | 1:ba8bb10ebd5a | 24 | |
el15mh | 0:4c58ed26b6ea | 25 | class Ball |
el15mh | 0:4c58ed26b6ea | 26 | { |
el15mh | 0:4c58ed26b6ea | 27 | |
el15mh | 0:4c58ed26b6ea | 28 | public: |
el15mh | 0:4c58ed26b6ea | 29 | |
el15mh | 0:4c58ed26b6ea | 30 | Ball(); |
el15mh | 0:4c58ed26b6ea | 31 | ~Ball(); |
el15mh | 0:4c58ed26b6ea | 32 | |
el15mh | 2:bcb96ab2848b | 33 | void init(float x, float y, int radius, bool colour); |
el15mh | 2:bcb96ab2848b | 34 | void update(Vector2D position); |
el15mh | 1:ba8bb10ebd5a | 35 | void draw(N5110 &lcd); |
el15mh | 0:4c58ed26b6ea | 36 | |
el15mh | 2:bcb96ab2848b | 37 | Vector2D getPosition(); |
el15mh | 2:bcb96ab2848b | 38 | Vector2D getVelocity(); |
el15mh | 2:bcb96ab2848b | 39 | |
el15mh | 2:bcb96ab2848b | 40 | void setPosition(Vector2D p); |
el15mh | 2:bcb96ab2848b | 41 | void setVelocity(Vector2D v); |
el15mh | 2:bcb96ab2848b | 42 | |
el15mh | 0:4c58ed26b6ea | 43 | private: |
el15mh | 0:4c58ed26b6ea | 44 | |
el15mh | 1:ba8bb10ebd5a | 45 | Vector2D velocity; |
el15mh | 1:ba8bb10ebd5a | 46 | |
el15mh | 2:bcb96ab2848b | 47 | Vector2D checkForInterference(Vector2D velocity); |
el15mh | 2:bcb96ab2848b | 48 | |
el15mh | 0:4c58ed26b6ea | 49 | int _radius; |
el15mh | 2:bcb96ab2848b | 50 | |
el15mh | 2:bcb96ab2848b | 51 | float _x; |
el15mh | 2:bcb96ab2848b | 52 | float _y; |
el15mh | 2:bcb96ab2848b | 53 | bool _colour; |
el15mh | 0:4c58ed26b6ea | 54 | |
el15mh | 0:4c58ed26b6ea | 55 | }; |
el15mh | 0:4c58ed26b6ea | 56 | |
el15mh | 0:4c58ed26b6ea | 57 | #endif /* BALL_H */ |