mirror of
https://github.com/GayPizzaSpecifications/cxx-swift-interop.git
synced 2025-08-03 13:11:31 +00:00
minor improvements
This commit is contained in:
@ -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 {
|
void BallWorld::add(Ball::vec2f pos, float angle, float ballSize) noexcept {
|
||||||
balls.emplace_back(Ball{ pos, angle, ballSize });
|
balls.emplace_back(Ball{ pos, angle, ballSize });
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,10 @@ public:
|
|||||||
|
|
||||||
void update(float deltaTime) noexcept;
|
void update(float deltaTime) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] constexpr const vec2f& position() const noexcept {
|
[[nodiscard]] constexpr vec2f position() const noexcept {
|
||||||
return _position;
|
return _position;
|
||||||
}
|
}
|
||||||
[[nodiscard]] constexpr const vec2f& velocity() const noexcept {
|
[[nodiscard]] constexpr vec2f velocity() const noexcept {
|
||||||
return _velocity;
|
return _velocity;
|
||||||
}
|
}
|
||||||
[[nodiscard]] constexpr const float size() const noexcept {
|
[[nodiscard]] constexpr const float size() const noexcept {
|
||||||
@ -34,7 +34,7 @@ public:
|
|||||||
struct BallWorld {
|
struct BallWorld {
|
||||||
std::vector<Ball> balls;
|
std::vector<Ball> balls;
|
||||||
|
|
||||||
BallWorld() noexcept;
|
BallWorld() noexcept = default;
|
||||||
virtual ~BallWorld() noexcept = default;
|
virtual ~BallWorld() noexcept = default;
|
||||||
|
|
||||||
void add(Ball::vec2f pos, float angle, float ballSize) noexcept;
|
void add(Ball::vec2f pos, float angle, float ballSize) noexcept;
|
||||||
|
@ -82,8 +82,8 @@ class Application {
|
|||||||
for ball in balls.balls {
|
for ball in balls.balls {
|
||||||
let position = ball.position(), size = ball.size()
|
let position = ball.position(), size = ball.size()
|
||||||
var rect = SDL_FRect(
|
var rect = SDL_FRect(
|
||||||
x: position.pointee.x - size,
|
x: position.x - size,
|
||||||
y: position.pointee.y - size,
|
y: position.y - size,
|
||||||
w: size * 2.0,
|
w: size * 2.0,
|
||||||
h: size * 2.0
|
h: size * 2.0
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user