game/sdlpp/sdlpp_circlecolider.hpp
2021-04-26 21:57:31 +02:00

41 lines
1.4 KiB
C++

#ifndef SDLPP_HPP_CIRCLE
#define SDLPP_HPP_CIRCLE
#include <vector>
#include "sdlpp_common.hpp"
#include "sdlpp_collision.hpp"
namespace SDLPP {
class SDLPPSCOPE CircleColider : public CollisionPolygon {
public:
CircleColider( double x, double y, double rad );
CircleColider( const Vec2D< double > &center, double rad );
CircleColider( double x, double y, double rad, uint64_t id );
CircleColider( const Vec2D< double > &center, double rad, uint64_t id );
virtual ~CircleColider() {}
virtual bool colidesWith( const CollisionPolygon &other ) const override;
virtual bool isCircle() const override;
virtual int topmost() const override;
virtual int bottommost() const override;
virtual int leftmost() const override;
virtual int rightmost() const override;
virtual void updateCollision( int x, int y, int w, int h,
uint64_t id ) override;
virtual void render( Renderer &renderer, const SDL_Color &color,
const SDL_Color &outline_color ) override;
virtual void render( Renderer &renderer, const SDL_Color &color ) override;
virtual void render( Renderer &renderer ) override;
virtual std::shared_ptr< CollisionPolygon > copySelf() override;
virtual std::vector< Line< int > > getLines() const override;
private:
int getRadius() const;
double original_rad;
int rad_;
};
} // namespace SDLPP
#endif