game/sdlpp/sdlpp_circlecolider.hpp

41 lines
1.4 KiB
C++
Raw Normal View History

2020-11-21 19:57:40 +00:00
#ifndef SDLPP_HPP_CIRCLE
#define SDLPP_HPP_CIRCLE
#include <vector>
#include "sdlpp_common.hpp"
#include "sdlpp_collision.hpp"
namespace SDLPP {
2020-11-22 22:37:55 +00:00
class SDLPPSCOPE CircleColider : public CollisionPolygon {
2020-11-21 19:57:40 +00:00
public:
CircleColider( double x, double y, double rad );
CircleColider( const Vec2D< double > &center, double rad );
2021-04-26 19:57:31 +00:00
CircleColider( double x, double y, double rad, uint64_t id );
CircleColider( const Vec2D< double > &center, double rad, uint64_t id );
2020-11-21 19:57:40 +00:00
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;
2021-04-26 19:57:31 +00:00
virtual void updateCollision( int x, int y, int w, int h,
uint64_t id ) override;
2021-03-13 14:05:16 +00:00
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;
2020-11-21 19:57:40 +00:00
virtual void render( Renderer &renderer ) override;
virtual std::shared_ptr< CollisionPolygon > copySelf() override;
virtual std::vector< Line< int > > getLines() const override;
2020-11-21 19:57:40 +00:00
private:
int getRadius() const;
double original_rad;
int rad_;
};
} // namespace SDLPP
#endif