From c33211182a3ef7b710fe486dc4b41eb72ca064d8 Mon Sep 17 00:00:00 2001 From: Hartmut Seichter Date: Sat, 1 Jul 2023 22:43:05 +0200 Subject: [PATCH] minor cleanup --- examples/pong/pong.cpp | 7 +------ src/lib/include/paradiso/aabb.hpp | 5 +++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/examples/pong/pong.cpp b/examples/pong/pong.cpp index 1643d92..11f89f0 100644 --- a/examples/pong/pong.cpp +++ b/examples/pong/pong.cpp @@ -41,12 +41,6 @@ struct PongStage { auto t = (min_el.second <= eps) ? min_el.first : TouchPoint::None; - if (t != TouchPoint::None) { - sprite.bitmap.pixel(0,0) = paradiso::RGBA::white(); - } else { - sprite.bitmap.pixel(0,0) = paradiso::RGBA::black(); - } - return t; }; @@ -116,6 +110,7 @@ struct PongBall { .scale = paradiso::Vector2::make(0.0125f, 0.0125f), }; + // interaction Stage - Ball void interact(PongStage& stage) { auto touch = stage.touch(sprite.pivot); diff --git a/src/lib/include/paradiso/aabb.hpp b/src/lib/include/paradiso/aabb.hpp index 8a8b77a..62267bf 100644 --- a/src/lib/include/paradiso/aabb.hpp +++ b/src/lib/include/paradiso/aabb.hpp @@ -24,6 +24,7 @@ #ifndef PARADISO_AABB_HPP #define PARADISO_AABB_HPP +#include #include namespace paradiso { @@ -32,7 +33,7 @@ struct AABB final { Vector2 top_left{}; Vector2 bottom_right{}; - static constexpr AABB from_vertices(auto& vertices) noexcept { + static constexpr AABB from_vertices(const auto& vertices) noexcept { Matrix<2, 2, float> min_max; min_max.set_slice<2, 1>(0, 0) = vertices.front(); @@ -51,7 +52,7 @@ struct AABB final { } bool constexpr is_inside(const Vector2& v) const { - return (v.x() >= top_left.x() && v.x() <= bottom_right.x() && + return (v.x() >= top_left.x() && v.x() <= bottom_right.x() && v.y() >= top_left.y() && v.y() <= bottom_right.y()); } };