SDLPP: add collider IDs
This commit is contained in:
@@ -41,18 +41,20 @@ void RenderObject::setPos( const Vec2D< double > &vec ) {
|
||||
Vec2D< double > RenderObject::getPos() const {
|
||||
return original;
|
||||
}
|
||||
bool RenderObject::colidesWith( const RenderObject &other ) const {
|
||||
std::vector< uint64_t >
|
||||
RenderObject::colidesWith( const RenderObject &other ) const {
|
||||
if ( !hasCollisions() || !other.hasCollisions() || getHidden() ||
|
||||
other.getHidden() ) {
|
||||
return false;
|
||||
return {};
|
||||
}
|
||||
std::vector< uint64_t > ret = {};
|
||||
for ( const auto &x : collisions ) {
|
||||
for ( const auto &y : other.getCollisions() ) {
|
||||
if ( x->colidesWith( *y ) )
|
||||
return true;
|
||||
ret.push_back( x->getId() );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return ret;
|
||||
}
|
||||
bool RenderObject::hasCollisions() const {
|
||||
return !collisions.empty();
|
||||
|
||||
Reference in New Issue
Block a user