mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
a bit of hero window
help needed - make something to prevent changing surface stored in CHeroWindow::background. I do not overwrite it, but it changes dramatically with every call of CHeroWindow method! And besides - is there anything to make my window displayed easily, without calling show() every frame when it should be displayed? any machanism?
This commit is contained in:
32
CHeroWindow.cpp
Normal file
32
CHeroWindow.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "stdafx.h"
|
||||
#include "CHeroWindow.h"
|
||||
#include "SDL.h"
|
||||
#include "SDL_Extensions.h"
|
||||
|
||||
extern SDL_Surface * ekran;
|
||||
|
||||
CHeroWindow::CHeroWindow()
|
||||
{
|
||||
background = SDL_LoadBMP("Data\\HEROSCR4.bmp");
|
||||
pos.x = 0;
|
||||
pos.y = 0;
|
||||
pos.h = background->h;
|
||||
pos.w = background->w;
|
||||
}
|
||||
|
||||
CHeroWindow::~CHeroWindow()
|
||||
{
|
||||
SDL_FreeSurface(background);
|
||||
}
|
||||
|
||||
void CHeroWindow::show(SDL_Surface *to)
|
||||
{
|
||||
if(!to)
|
||||
to=ekran;
|
||||
blitAt(background,pos.x,pos.y,to);
|
||||
}
|
||||
|
||||
void CHeroWindow::setHero(const CGHeroInstance *hero)
|
||||
{
|
||||
curHero = hero;
|
||||
}
|
||||
Reference in New Issue
Block a user