#pragma once #include #include "KCollider.h" namespace KapitanGame { class KCircle; class KRect final : public KCollider { public: KRect(KSolid* parent, const float width, const float height) : KCollider(parent), Width(width), Height(height) { } [[nodiscard]] float GetWidth() const override; [[nodiscard]] float GetHeight() const override; static KVector2D GetSeparationVector(float left, float right, float top, float bottom); bool IsCollision(const KCollider* other) const override; KVector2D GetSeparationVector(const KCollider* other) const override; [[nodiscard]] KVector2D GetSeparationVector(const SDL_FRect& map) const override; private: KVector2D GetSeparationVector(const KCircle* other) const; KVector2D GetSeparationVector(const KRect* other) const; bool IsCollision(const KCircle* other) const; [[nodiscard]] float GetLeft() const; [[nodiscard]] float GetRight() const; [[nodiscard]] float GetBottom() const; [[nodiscard]] float GetTop() const; bool IsCollision(const KRect* other) const; float Width; float Height; }; }