Imposible canviar la rendererSurface

This commit is contained in:
2025-03-05 18:51:36 +01:00
parent d41b0cb31c
commit 70a50f5117
16 changed files with 199 additions and 257 deletions

View File

@@ -234,27 +234,27 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, in
n.rect = {desp_h, y_pos, width, height};
// Crea la textura
n.surface = std::make_shared<Surface>(Screen::get()->getRenderSurfaceData(), width, height);
n.surface = std::make_shared<Surface>(Screen::get()->getRendererSurface(), width, height);
// Prepara para dibujar en la textura
Screen::get()->setRenderSurfaceData(n.surface);
Screen::get()->setRendererSurface(n.surface);
// Dibuja el fondo de la notificación
SDL_Rect rect;
auto surface_data = *(Screen::get()->getRenderSurfaceData());
auto surface = Screen::get()->getRendererSurface();
if (shape == NotificationShape::ROUNDED)
{
rect = {4, 0, width - (4 * 2), height};
n.surface->fillRect(surface_data, &rect, bg_color_);
surface->fillRect(&rect, bg_color_);
rect = {4 / 2, 1, width - 4, height - 2};
n.surface->fillRect(surface_data, &rect, bg_color_);
surface->fillRect(&rect, bg_color_);
rect = {1, 4 / 2, width - 2, height - 4};
n.surface->fillRect(surface_data, &rect, bg_color_);
surface->fillRect(&rect, bg_color_);
rect = {0, 4, width, height - (4 * 2)};
n.surface->fillRect(surface_data, &rect, bg_color_);
surface->fillRect(&rect, bg_color_);
}
else if (shape == NotificationShape::SQUARED)
@@ -288,7 +288,7 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, in
}
// Deja de dibujar en la textura
Screen::get()->setRenderSurfaceData(nullptr);
Screen::get()->setRendererSurface(nullptr);
// Crea el sprite de la notificación
n.sprite = std::make_shared<SSprite>(n.surface, n.rect);