diff options
Diffstat (limited to 'pong.h')
| -rw-r--r-- | pong.h | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -3,15 +3,20 @@ #include <stdint.h> -typedef struct point_t { +constexpr int PADDLE_WIDTH = 16; +constexpr int PADDLE_HEIGHT = 128; +constexpr int BALL_WIDTH = 16; +constexpr int BALL_HEIGHT = 16; + +typedef struct vector_t { int32_t x; int32_t y; -} point_t; +} vector_t; /* paddles have a fixed x position and velocity */ struct moveable_t { - point_t position; - point_t velocity; + vector_t position; + vector_t velocity; uint8_t width; uint8_t height; }; @@ -19,7 +24,7 @@ struct moveable_t { typedef struct moveable_t ball_t; typedef struct moveable_t paddle_t; -void UpdatePosition ( point_t * const position, const point_t velocity ); +void UpdatePosition ( vector_t * const position, const vector_t velocity ); bool CheckMoveableCollision ( const struct moveable_t m1, const struct moveable_t m2 ); bool CheckLeftWallCollision ( const struct moveable_t m ); bool CheckRightWallCollision ( const struct moveable_t m ); |
