2dkg/2dkg_zad5/2dgk_zad5/KCircle.h
2022-01-20 08:52:14 +01:00

33 lines
845 B
C++

#pragma once
#include <SDL_rect.h>
#include "KCollider.h"
#include "KVector2d.h"
namespace KapitanGame {
class KRect;
class KCircle final : public KCollider
{
public:
KCircle(KSolid* parent, float radius);
[[nodiscard]] float GetRadius() const;
private:
KVector2D GetSeparationVector(const KCircle* other) const;
KVector2D GetSeparationVector(const KRect* other) const;
bool IsCollision(const KCircle* other) const;
bool IsCollision(const KRect* other) const;
public:
bool IsCollision(const KCollider* other) const override;
KVector2D GetSeparationVector(const KCollider* other) const override;
[[nodiscard]] KVector2D GetSeparationVector(const SDL_FRect& map) const override;
[[nodiscard]] float GetWidth() const override;
[[nodiscard]] float GetHeight() const override;
private:
float Radius{ 1.f };
};
}