SDLPP: Allow changing coliders' position
Requires `updateSizeAndPosition` to be run on the parent container
This commit is contained in:
parent
79d5f348c4
commit
0c4f2482c7
@ -30,6 +30,14 @@ void CollisionPolygon::updateCollision( int x, int y, int w, int h,
|
|||||||
position = Vec2D< int >( original.getX() * w + x, original.getY() * h + y );
|
position = Vec2D< int >( original.getX() * w + x, original.getY() * h + y );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CollisionPolygon::setPos(const Vec2D<double> &pos) {
|
||||||
|
original = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CollisionPolygon::setPos(double x, double y) {
|
||||||
|
setPos({x, y});
|
||||||
|
}
|
||||||
|
|
||||||
int CollisionPolygon::getX() const {
|
int CollisionPolygon::getX() const {
|
||||||
return position.getX();
|
return position.getX();
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ public:
|
|||||||
const SDL_Color &outline_color ) = 0;
|
const SDL_Color &outline_color ) = 0;
|
||||||
virtual void render( Renderer &renderer, const SDL_Color &color ) = 0;
|
virtual void render( Renderer &renderer, const SDL_Color &color ) = 0;
|
||||||
virtual void render( Renderer &renderer ) = 0;
|
virtual void render( Renderer &renderer ) = 0;
|
||||||
|
void setPos(const Vec2D<double> &pos);
|
||||||
|
void setPos(double x, double y);
|
||||||
int getX() const;
|
int getX() const;
|
||||||
int getY() const;
|
int getY() const;
|
||||||
void setColor( const std::string &color );
|
void setColor( const std::string &color );
|
||||||
|
Loading…
Reference in New Issue
Block a user