diff options
author | Aki <please@ignore.pl> | 2022-04-18 11:12:37 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-04-18 11:12:37 +0200 |
commit | 9026eea38124b73b17f19b137dbc71eab4a7a2e9 (patch) | |
tree | 22a3d0fb72f1ba3364e2c09eaba100a9fda81dec | |
parent | 2773854a3e749512826fa8b71b77e754be79836f (diff) | |
download | bullethell2022-9026eea38124b73b17f19b137dbc71eab4a7a2e9.zip bullethell2022-9026eea38124b73b17f19b137dbc71eab4a7a2e9.tar.gz bullethell2022-9026eea38124b73b17f19b137dbc71eab4a7a2e9.tar.bz2 |
Cleaned up ConstantVelocity a bit
-rw-r--r-- | ConstantVelocity.cpp | 10 | ||||
-rw-r--r-- | ConstantVelocity.h | 28 |
2 files changed, 14 insertions, 24 deletions
diff --git a/ConstantVelocity.cpp b/ConstantVelocity.cpp index 37f3c3d..efe3117 100644 --- a/ConstantVelocity.cpp +++ b/ConstantVelocity.cpp @@ -3,15 +3,9 @@ #include <raylib.h> -ConstantVelocitySystem::ConstantVelocitySystem() : - ConstantVelocitySystem(10000) +ConstantVelocitySystem::ConstantVelocitySystem() { -} - - -ConstantVelocitySystem::ConstantVelocitySystem(int reserved) -{ - m_bullets.reserve(reserved); + m_bullets.reserve(RESERVED); } diff --git a/ConstantVelocity.h b/ConstantVelocity.h index 3970aff..e28400d 100644 --- a/ConstantVelocity.h +++ b/ConstantVelocity.h @@ -5,22 +5,6 @@ #include <raylib.h> -static constexpr float MARGIN {40}; - - -struct ConstantVelocityBullet; - - -struct ConstantVelocitySystem -{ - ConstantVelocitySystem(); - explicit ConstantVelocitySystem(int reserved); - void update(float dt); - void draw(); - std::vector<ConstantVelocityBullet> m_bullets; -}; - - struct ConstantVelocityBullet { using Vector = std::vector<ConstantVelocityBullet>; @@ -29,3 +13,15 @@ struct ConstantVelocityBullet float radius; Color color; }; + + +struct ConstantVelocitySystem +{ + static constexpr float MARGIN {40}; + static constexpr int RESERVED {10000}; + + ConstantVelocitySystem(); + void update(float dt); + void draw(); + ConstantVelocityBullet::Vector m_bullets; +}; |