minor improvements

This commit is contained in:
a dinosaur 2024-09-22 01:04:59 +10:00
parent 77603b582c
commit 3a7afe366b
3 changed files with 5 additions and 7 deletions

View File

@ -30,8 +30,6 @@ void Ball::update(float deltaTime) noexcept {
}
BallWorld::BallWorld() noexcept : balls() {}
void BallWorld::add(Ball::vec2f pos, float angle, float ballSize) noexcept {
balls.emplace_back(Ball{ pos, angle, ballSize });
}

View File

@ -19,10 +19,10 @@ public:
void update(float deltaTime) noexcept;
[[nodiscard]] constexpr const vec2f& position() const noexcept {
[[nodiscard]] constexpr vec2f position() const noexcept {
return _position;
}
[[nodiscard]] constexpr const vec2f& velocity() const noexcept {
[[nodiscard]] constexpr vec2f velocity() const noexcept {
return _velocity;
}
[[nodiscard]] constexpr const float size() const noexcept {
@ -34,7 +34,7 @@ public:
struct BallWorld {
std::vector<Ball> balls;
BallWorld() noexcept;
BallWorld() noexcept = default;
virtual ~BallWorld() noexcept = default;
void add(Ball::vec2f pos, float angle, float ballSize) noexcept;

View File

@ -82,8 +82,8 @@ class Application {
for ball in balls.balls {
let position = ball.position(), size = ball.size()
var rect = SDL_FRect(
x: position.pointee.x - size,
y: position.pointee.y - size,
x: position.x - size,
y: position.y - size,
w: size * 2.0,
h: size * 2.0
)