Moved common functionality and includes around
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user