SDLPP: add function that returns absolute position

This commit is contained in:
zvon 2021-08-06 18:48:52 +02:00
parent 7d9763443a
commit b87318f44d
2 changed files with 6 additions and 1 deletions

View File

@ -46,6 +46,9 @@ void RenderObject::setPos( const Vec2D< double > &vec ) {
Vec2D< double > RenderObject::getPos() const {
return original;
}
Vec2D< double > RenderObject::getAbsolutePos() const {
return current;
}
std::vector< uint64_t >
RenderObject::colidesWith( const RenderObject &other ) const {
if ( !hasCollisions() || !other.hasCollisions() || getHidden() ||
@ -289,7 +292,8 @@ void RenderObject::rotateCounterClockwise( int angle ) {
rotateClockwise( 360 - ( angle % 360 ) );
}
Vec2D< double > RenderObject::computeAlignmentAdditions() {
double x_addition = 0, y_addition = 0;
double x_addition = 0;
double y_addition = 0;
auto dimensions = renderer->getDoubleDimensions();
auto width_diff = dimensions.getX() - 1;
auto height_diff = dimensions.getY() - 1;

View File

@ -46,6 +46,7 @@ public:
virtual void setPos( const std::pair< double, double > &pos );
virtual void setPos( const Vec2D< double > &vec );
virtual Vec2D< double > getPos() const;
virtual Vec2D< double > getAbsolutePos() const;
std::vector< uint64_t > colidesWith( const RenderObject &other ) const;
template < class T > void addCollision( const T &p ) {
collisions.push_back( std::make_shared< T >( p ) );