1st part of implementing blended screenshots (see #395)

This commit is contained in:
thrust26 2018-12-06 14:24:07 +01:00
parent b06893d384
commit bef5caafa5
3 changed files with 20 additions and 2 deletions

View File

@ -46,6 +46,7 @@
#include "M6532.hxx"
#include "MouseControl.hxx"
#include "PNGLibrary.hxx"
#include "TIASurface.hxx"
#include "EventHandler.hxx"
@ -386,7 +387,8 @@ void EventHandler::handleEvent(Event::Type event, Int32 state)
return;
case Event::TakeSnapshot:
if(state) myOSystem.png().takeSnapshot();
//if(state) myOSystem.png().takeSnapshot();
if(state) myOSystem.frameBuffer().tiaSurface().saveSnapShot();
return;
case Event::LauncherMode:

View File

@ -23,6 +23,7 @@
#include "OSystem.hxx"
#include "Console.hxx"
#include "TIA.hxx"
#include "PNGLibrary.hxx"
#include "TIASurface.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -34,7 +35,8 @@ TIASurface::TIASurface(OSystem& system)
myUsePhosphor(false),
myPhosphorPercent(0.60f),
myScanlinesEnabled(false),
myPalette(nullptr)
myPalette(nullptr),
saveFlag(false)
{
// Load NTSC filter settings
myNTSCFilter.loadConfig(myOSystem.settings());
@ -389,6 +391,12 @@ void TIASurface::render()
// Draw overlaying scanlines
if(myScanlinesEnabled)
mySLineSurface->render();
if(saveFlag)
{
saveFlag = false;
myOSystem.png().takeSnapshot();
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -155,6 +155,11 @@ class TIASurface
*/
void reRender();
/**
Save a snapshot after rendering.
*/
void saveSnapShot() { saveFlag = true; }
private:
OSystem& myOSystem;
FrameBuffer& myFB;
@ -202,6 +207,9 @@ class TIASurface
// Palette for normal TIA rendering mode
const uInt32* myPalette;
// Flag for saving a snapshot
bool saveFlag;
private:
// Following constructors and assignment operators not supported
TIASurface() = delete;