Pause menu
This commit is contained in:
@@ -277,14 +277,18 @@ public:
|
||||
texture = t;
|
||||
}
|
||||
void setTexture(const std::string &img_path) {
|
||||
if(polygon)
|
||||
polygon.reset();
|
||||
texture = std::make_shared<Texture>(renderer, img_path);
|
||||
}
|
||||
virtual void setColor(const std::string &color) = 0;
|
||||
void setTexture(Font &font, const std::string &text, const std::string &color = "FFFFFF", const std::string &outline_color = "000000", int outline_size = -1) {
|
||||
texture = std::make_shared<Texture>(renderer, font, text, color, outline_color, outline_size);
|
||||
}
|
||||
virtual void setColor(const std::string &color) = 0;
|
||||
virtual void unsetTexture() {
|
||||
texture.reset();
|
||||
}
|
||||
virtual void unsetColor() {
|
||||
polygon.reset();
|
||||
}
|
||||
// per second, relative to window width
|
||||
void setMovementSpeed(double speed) {
|
||||
movementSpeed = speed;
|
||||
@@ -655,19 +659,17 @@ public:
|
||||
}
|
||||
}
|
||||
virtual void setColor(const std::string &color) {
|
||||
if(texture)
|
||||
texture.reset();
|
||||
polygon = std::make_shared<Rect>(0,0,1,1);
|
||||
polygon->setColor(color);
|
||||
polygon->updateCollision(collisionPushX(), collisionPushY(), collisionWidth(), collisionHeight());
|
||||
}
|
||||
virtual void specialAction(int /*UNUSED*/) {};
|
||||
virtual void render() {
|
||||
if(texture != NULL && !getHidden())
|
||||
SDL_RenderCopy(renderer->getRendererPtr(), texture->getTexturePtr(), NULL, &rect);
|
||||
if(polygon) {
|
||||
polygon->render(*renderer);
|
||||
}
|
||||
if(texture != NULL && !getHidden())
|
||||
SDL_RenderCopy(renderer->getRendererPtr(), texture->getTexturePtr(), NULL, &rect);
|
||||
if(hasCollisions() && renderer->getRenderColiders() && !getHidden()) {
|
||||
for(const auto &col : getCollisions())
|
||||
col->render(*renderer, colider_color);
|
||||
|
||||
Reference in New Issue
Block a user