diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2024-02-20 18:33:42 -0500 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2024-02-20 18:33:42 -0500 |
| commit | 9e4797d2fe599acfbf13ed626df46650a88ef891 (patch) | |
| tree | 7b8afaf71d08859c6d8f0c564f08d8f67b343eb0 /pong.h | |
| parent | 563d44c4a3cabeddc442bfe8377bc2cdfde4a6dd (diff) | |
Changed loading of the sprite
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 ); |
