New collision detection
This commit is contained in:
@@ -4,13 +4,15 @@
|
||||
#include "sdlpp_common.hpp"
|
||||
#include "sdlpp_renderer.hpp"
|
||||
#include "sdlpp_vector.hpp"
|
||||
#include "sdlpp_line.hpp"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace SDLPP {
|
||||
class SDLPPSCOPE CollisionPolygon {
|
||||
public:
|
||||
CollisionPolygon( double x, double y );
|
||||
CollisionPolygon( const Vec2D<double> &input );
|
||||
CollisionPolygon( const Vec2D< double > &input );
|
||||
virtual ~CollisionPolygon() {}
|
||||
virtual bool colidesWith( const CollisionPolygon &other ) const = 0;
|
||||
virtual bool isCircle() const = 0;
|
||||
@@ -21,18 +23,20 @@ public:
|
||||
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, const SDL_Color &color,
|
||||
const SDL_Color &outline_color ) = 0;
|
||||
virtual void render( Renderer &renderer, const SDL_Color &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< CollisionPolygon > copySelf() = 0;
|
||||
virtual std::vector< Line< int > > getLines() const = 0;
|
||||
|
||||
protected:
|
||||
Vec2D<double> original;
|
||||
Vec2D<int> position;
|
||||
Vec2D< double > original;
|
||||
Vec2D< int > position;
|
||||
bool infinite = false;
|
||||
SDL_Color sdl_color = { 0, 0, 0, 0 };
|
||||
SDL_Color sdl_outline = { 0, 0, 0, 0 };
|
||||
|
||||
Reference in New Issue
Block a user