mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-07 00:58:39 +02:00
- background for main menu can be scaled. Won't work as default due to non-scalable video
This commit is contained in:
@ -70,6 +70,21 @@ CPicture::CPicture(SDL_Surface *BG, const Rect &SrcRect, int x /*= 0*/, int y /*
|
||||
freeSurf = free;
|
||||
}
|
||||
|
||||
void CPicture::setSurface(SDL_Surface *to)
|
||||
{
|
||||
bg = to;
|
||||
if (srcRect)
|
||||
{
|
||||
pos.w = srcRect->w;
|
||||
pos.h = srcRect->h;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.w = bg->w;
|
||||
pos.h = bg->h;
|
||||
}
|
||||
}
|
||||
|
||||
CPicture::~CPicture()
|
||||
{
|
||||
if(freeSurf)
|
||||
@ -115,6 +130,17 @@ void CPicture::convertToScreenBPP()
|
||||
SDL_FreeSurface(hlp);
|
||||
}
|
||||
|
||||
void CPicture::scaleTo(Point size)
|
||||
{
|
||||
SDL_Surface * scaled = CSDL_Ext::scaleSurface(bg, size.x, size.y);
|
||||
|
||||
if(freeSurf)
|
||||
SDL_FreeSurface(bg);
|
||||
|
||||
setSurface(scaled);
|
||||
freeSurf = false;
|
||||
}
|
||||
|
||||
void CPicture::createSimpleRect(const Rect &r, bool screenFormat, ui32 color)
|
||||
{
|
||||
pos += r;
|
||||
|
Reference in New Issue
Block a user