#ifndef SDLPP_HPP_COLLISION #define SDLPP_HPP_COLLISION #include "sdlpp_common.hpp" #include "sdlpp_renderer.hpp" namespace SDLPP { class SDLPPSCOPE CollisionPolygon { public: CollisionPolygon( double x, double y ); virtual ~CollisionPolygon() {} virtual bool colidesWith( const CollisionPolygon &other ) const = 0; virtual bool isCircle() const = 0; virtual bool isInfinite() const; virtual void setInfinite(); virtual int topmost() const = 0; virtual int bottommost() const = 0; virtual int leftmost() const = 0; virtual int rightmost() const = 0; virtual void updateCollision( int x, int y, int w, int h ); virtual void render( Renderer &renderer, const std::tuple< int, int, int, int > &color ) = 0; virtual void render( Renderer &renderer ) = 0; int getX() const; int getY() const; void setColor( const std::string &color ); void setOutlineColor( const std::string &color ); virtual std::shared_ptr copySelf() = 0; protected: double original_x; double original_y; int position_x; int position_y; bool infinite = false; SDL_Color sdl_color = { 0, 0, 0, 0 }; SDL_Color sdl_outline = { 0, 0, 0, 0 }; }; SDLPPSCOPE bool infinityIntersection( const SDLPP::CollisionPolygon &infinite, const SDLPP::CollisionPolygon &other ); SDLPPSCOPE bool intersects( const SDLPP::CollisionPolygon &p1, const SDLPP::CollisionPolygon &p2 ); } // namespace SDLPP #endif