From 81f51cea98850b4922029039e873f7ddc519ed45 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Mon, 15 Mar 2010 06:11:31 +0000 Subject: [PATCH] Take screenshot at each menu enter --- Src/gui/game_info_menu.cpp | 7 +++++-- Src/gui/gui.cpp | 6 ++++++ Src/gui/gui.hh | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Src/gui/game_info_menu.cpp b/Src/gui/game_info_menu.cpp index e14b77c..a40b7d9 100644 --- a/Src/gui/game_info_menu.cpp +++ b/Src/gui/game_info_menu.cpp @@ -57,8 +57,11 @@ public: switch (which) { case 0: - this->box->gi->setScreenshot(TheC64->TheDisplay->SurfaceFromC64Display()); - break; + { + SDL_Surface *tmp = SDL_DisplayFormat(Gui::gui->screenshot); + + this->box->gi->setScreenshot(tmp); + } break; case 2: case 3: case 4: diff --git a/Src/gui/gui.cpp b/Src/gui/gui.cpp index f7df6bb..27155ca 100644 --- a/Src/gui/gui.cpp +++ b/Src/gui/gui.cpp @@ -79,6 +79,7 @@ Gui::Gui() this->np = NULL; this->focus = NULL; + this->screenshot = NULL; this->bg_left = NULL; this->bg_middle = NULL; @@ -155,6 +156,8 @@ Gui::~Gui() if (VirtualKeyboard::kbd) delete VirtualKeyboard::kbd; + SDL_FreeSurface(this->screenshot); + SDL_FreeSurface(this->bg_left); SDL_FreeSurface(this->keyboard); SDL_FreeSurface(this->bg_middle); @@ -483,6 +486,9 @@ void Gui::draw(SDL_Surface *where) void Gui::activate() { + SDL_FreeSurface(this->screenshot); + this->screenshot = TheC64->TheDisplay->SurfaceFromC64Display(); + this->is_active = true; this->cur_prefs = ThePrefs; diff --git a/Src/gui/gui.hh b/Src/gui/gui.hh index f27b9d3..5ebec02 100644 --- a/Src/gui/gui.hh +++ b/Src/gui/gui.hh @@ -85,6 +85,7 @@ public: bool is_active; Menu *focus; /* Where the focus goes */ Menu *main_menu; + SDL_Surface *screenshot; SDL_Surface *background; SDL_Surface *main_menu_bg;