Set screenshot through a setter

This commit is contained in:
simon.kagstrom 2010-01-30 19:03:10 +00:00
parent 54e41df785
commit b3a33134aa
4 changed files with 12 additions and 3 deletions

View File

@ -50,7 +50,7 @@ public:
virtual void timeoutCallback()
{
if (!Gui::gui->cur_gameInfo->screenshot)
Gui::gui->cur_gameInfo->screenshot = TheC64->TheDisplay->SurfaceFromC64Display();
Gui::gui->cur_gameInfo->setScreenshot(TheC64->TheDisplay->SurfaceFromC64Display());
delete this;
}

View File

@ -210,3 +210,10 @@ void GameInfo::setName(const char *name)
free((void*)this->name);
this->name = xstrdup(name);
}
void GameInfo::setScreenshot(SDL_Surface *scr)
{
SDL_FreeSurface(this->screenshot);
this->screenshot = scr;
}

View File

@ -33,6 +33,8 @@ public:
void setName(const char *name);
void setScreenshot(SDL_Surface *scr);
void resetDefaults();
/** Returns an allocated dump structure */

View File

@ -41,7 +41,7 @@ public:
switch (which)
{
case 0:
this->box->gi->screenshot = TheC64->TheDisplay->SurfaceFromC64Display();;
this->box->gi->setScreenshot(TheC64->TheDisplay->SurfaceFromC64Display());
break;
case 2:
case 3:
@ -65,7 +65,7 @@ public:
{
SDL_Surface *p = TheC64->TheDisplay->SurfaceFromC64Display();
this->box->gi->screenshot = p;
this->box->gi->setScreenshot(p);
}
Gui::gui->popView();
}