Moved common functionality and includes around

This commit is contained in:
2025-12-08 15:31:43 +02:00
parent df4ead9f85
commit 3a52a3991c
4 changed files with 10 additions and 13 deletions

View File

@@ -4,6 +4,10 @@ Widget::Widget(int x, int y, int width, int height)
: m_surface(nullptr), m_rect{.x = x, .y = y, .w = width, .h = height}
{
m_surface = SDL_CreateRGBSurfaceWithFormat(0, width, height, 32, SDL_PIXELFORMAT_RGBA8888);
if (nullptr != m_surface)
{
SDL_SetSurfaceBlendMode(m_surface, SDL_BLENDMODE_BLEND);
}
}
Widget::~Widget()
@@ -39,4 +43,9 @@ void Widget::resize(int width, int height)
m_surface = SDL_CreateRGBSurfaceWithFormat(0, width, height, 32, SDL_PIXELFORMAT_RGBA8888);
m_rect.w = width;
m_rect.h = height;
if (nullptr != m_surface)
{
SDL_SetSurfaceBlendMode(m_surface, SDL_BLENDMODE_BLEND);
}
}