diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2024-07-14 13:04:54 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2024-07-14 13:04:54 -0400 |
| commit | a17dcfdcba9f7da5a91c554eef88cea73d6598b0 (patch) | |
| tree | 8371131c504fd13e88d98dad7d8421f93ceab3b2 /pong.c | |
| parent | 2957d6c5b970d62e5d3333434b323117aaf97fa9 (diff) | |
Redid the Cmake Config and fell back to C17master
Diffstat (limited to 'pong.c')
| -rw-r--r-- | pong.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1,13 +1,13 @@ #include "pong.h" #include "screen.h" -inline void UpdatePosition ( vector_t * const position, const vector_t velocity ) { +inline void UpdatePosition(vector_t * const position, const vector_t velocity) { position->x += velocity.x ; position->y += velocity.y ; } /* CheckMoveableCollision: Implementation of AABB collision for moveable objects */ -bool CheckMoveableCollision ( const struct moveable_t m1, const struct moveable_t m2 ) { +bool CheckMoveableCollision(const struct moveable_t m1, const struct moveable_t m2) { const vector_t m1p = m1.position; const vector_t m2p = m2.position; const bool checkX = m1p.x + m1.width > m2p.x, @@ -15,23 +15,23 @@ bool CheckMoveableCollision ( const struct moveable_t m1, const struct moveable_ return checkX && checkY; } -bool CheckLeftWallCollision ( const struct moveable_t m ) { +bool CheckLeftWallCollision(const struct moveable_t m) { return m.position.x < 0 ; } -bool CheckRightWallCollision ( const struct moveable_t m ) { +bool CheckRightWallCollision(const struct moveable_t m) { return m.position.x + m.width > SCREEN_WIDTH; } -bool CheckGroundCollision ( const struct moveable_t m ) { +bool CheckGroundCollision(const struct moveable_t m) { return m.position.y + m.height > SCREEN_HEIGHT; } -bool CheckCeilingCollision ( const struct moveable_t m ) { +bool CheckCeilingCollision(const struct moveable_t m) { return m.position.y < 0; } -void Reset ( ball_t * const ball ) { - ball->position = ( vector_t ) { SCREEN_WIDTH >> 1, SCREEN_HEIGHT >> 1 }; - ball->velocity = ( vector_t ){ 1, 1 }; +void Reset(ball_t * const ball) { + ball->position = (vector_t) {SCREEN_WIDTH >> 1, SCREEN_HEIGHT >> 1}; + ball->velocity = (vector_t){1, 1}; } |
