1
0
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:
Ivan Savenko
2012-05-20 11:03:21 +00:00
parent 88639be91b
commit 59255a4cad
8 changed files with 68 additions and 28 deletions

View File

@ -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;