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 FATFileSystem
Diff: Ball/Ball.h
- Revision:
- 12:7f7fadb5c106
- Parent:
- 11:6d2027253aa9
- Child:
- 14:08ac9aaa34c3
--- a/Ball/Ball.h Thu Apr 25 15:16:38 2019 +0000
+++ b/Ball/Ball.h Fri May 03 09:39:24 2019 +0000
@@ -6,8 +6,8 @@
#include "Gamepad.h"
/** Enum for wall types */
-enum WallType {
-
+enum WallType {
+
LEFT, /**< left wall */
RIGHT, /**< right wall */
TOP, /**< top wall */
@@ -17,28 +17,33 @@
TOPLEFT, /**< top left 45 deg wall */
TOPRIGHT, /**< top right 45 deg wall */
-
};
/** Pixel Coordinate Struct*/
struct Coord {
+
int x; /**< coordinate of x pixel */
int y; /**< coordinate of y pixel */
+
};
-/** Map Layout struct */
+/** Wall Information struct */
struct WallMap {
+
WallType wall; /**< wall type */
Coord start; /**< coordinate of line start */
Coord end; /**< coordinate of line end */
+
};
/** Levels Information struct */
struct Levels {
+
Coord ball; /**< start position of ball */
Coord hole; /**< position of hole */
- WallMap walls[14]; /**< array of wall plots */
- int wall_count;
+ WallMap walls[16]; /**< array of walls */
+ int wall_count; /**< number of walls in level */
+
};
@@ -70,21 +75,21 @@
void drawAim(N5110 &lcd, Vector2D joy_coord ,float angle);
void move_ball();
-
- Vector2D get_ball_pos();
-
+
void shoot_ball(Gamepad &pad, Vector2D joy_coord);
-
- int get_shot_count();
+
+ void set_total_shot_count(int total_shot_count);
int get_total_shot_count();
- void set_total_shot_count(int total_shot_count);
-
bool check_hole(Coord hole);
void check_wall_bounce(WallMap map[], int size);
+ void set_frame_rate(int frame_rate);
+
+private:
+
void left_bounce(Coord start, Coord end);
void right_bounce(Coord start, Coord end);
@@ -101,18 +106,22 @@
void top_right_bounce(Coord start, Coord end);
- void set_frame_rate(int frame_rate);
-
-private:
+ float _x_pos;
- float _x_pos;
float _y_pos;
+
float _x_vel;
+
float _y_vel;
+
int _shot_count;
+
int _total_shot_count;
+
int _frame_rate;
+
Direction _direction;
+
};
#endif
\ No newline at end of file