Trying to switch to more object-oriented
This commit is contained in:
@@ -28,15 +28,17 @@ void RenderObject::render() {
|
||||
}
|
||||
}
|
||||
void RenderObject::setPos( double x, double y ) {
|
||||
og_x = x;
|
||||
og_y = y;
|
||||
original = { x, y };
|
||||
updateSizeAndPosition();
|
||||
}
|
||||
void RenderObject::setPos( const std::pair< double, double > &pos ) {
|
||||
setPos( pos.first, pos.second );
|
||||
}
|
||||
std::pair< double, double > RenderObject::getPos() const {
|
||||
return { og_x, og_y };
|
||||
void RenderObject::setPos( const Vec2D<double> &vec ) {
|
||||
setPos( vec.getX(), vec.getY() );
|
||||
}
|
||||
Vec2D< double > RenderObject::getPos() const {
|
||||
return original;
|
||||
}
|
||||
bool RenderObject::colidesWith( const RenderObject &other ) const {
|
||||
if ( !hasCollisions() || !other.hasCollisions() || getHidden() ||
|
||||
@@ -161,8 +163,7 @@ void RenderObject::move( int ticks ) {
|
||||
if ( std::isnan( addx ) || std::isnan( addy ) )
|
||||
return;
|
||||
|
||||
og_x += addx;
|
||||
og_y += addy;
|
||||
original += { addx, addy };
|
||||
|
||||
custom_move( ticks );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user