mirror of
https://github.com/GayPizzaSpecifications/cxx-swift-interop.git
synced 2025-08-02 21:00:56 +00:00
minor improvements
This commit is contained in:
parent
77603b582c
commit
3a7afe366b
@ -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 });
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user