Render polygon BEFORE collisions

This commit is contained in:
zvon 2020-08-22 14:15:12 +02:00
parent bf0d08ae16
commit 94aed4cd02

View File

@ -665,13 +665,13 @@ public:
virtual void render() { virtual void render() {
if(texture != NULL && !getHidden()) if(texture != NULL && !getHidden())
SDL_RenderCopy(renderer->getRendererPtr(), texture->getTexturePtr(), NULL, &rect); SDL_RenderCopy(renderer->getRendererPtr(), texture->getTexturePtr(), NULL, &rect);
if(polygon) {
polygon->render(*renderer);
}
if(hasCollisions() && renderer->getRenderColiders() && !getHidden()) { if(hasCollisions() && renderer->getRenderColiders() && !getHidden()) {
for(const auto &col : getCollisions()) for(const auto &col : getCollisions())
col->render(*renderer, colider_color); col->render(*renderer, colider_color);
} }
if(polygon) {
polygon->render(*renderer);
}
} }
virtual void move(int ticks) { virtual void move(int ticks) {
if(permanent) if(permanent)
@ -692,7 +692,7 @@ public:
if(polygon) if(polygon)
polygon->updateCollision(collisionPushX(), collisionPushY(), collisionWidth(), collisionHeight()); polygon->updateCollision(collisionPushX(), collisionPushY(), collisionWidth(), collisionHeight());
} }
virtual void custom_move(int ticks) {} virtual void custom_move(int /*UNUSED*/) {}
virtual std::pair<std::pair<double,double>,std::pair<double,double>> getDoubleRect() { virtual std::pair<std::pair<double,double>,std::pair<double,double>> getDoubleRect() {
return {{x_,y_}, {w_,h_}}; return {{x_,y_}, {w_,h_}};
} }