AbstractFrameManager adjustments.

This commit is contained in:
Christian Speckner 2017-10-03 23:08:14 +02:00
parent d220888474
commit d52562975d
2 changed files with 45 additions and 20 deletions

View File

@ -18,19 +18,37 @@
#include "AbstractFrameManager.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFrameManager::AbstractFrameManager() :
myIsRendering(false),
myVsync(false),
myVblank(false),
myCurrentFrameFinalLines(0),
myPreviousFrameFinalLines(0),
myTotalFrames(0),
myLayout(FrameLayout::ntsc),
myFrameRate(0),
myOnFrameComplete(0),
myOnFrameStart(0),
myOnRenderingStart(0)
{}
AbstractFrameManager::AbstractFrameManager()
{
reset();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AbstractFrameManager::reset()
{
myIsRendering = false;
myVsync = false;
myVblank = false;
myCurrentFrameTotalLines = 0;
myCurrentFrameFinalLines = 0;
myPreviousFrameFinalLines = 0;
myTotalFrames = 0;
myLayout = FrameLayout::ntsc;
myFrameRate = 0;
myOnFrameComplete = 0;
myOnFrameStart = 0;
myOnRenderingStart = 0;
onReset();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AbstractFrameManager::nextLine()
{
myCurrentFrameTotalLines++;
onNextLine();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AbstractFrameManager::setHandlers(
@ -70,10 +88,11 @@ void AbstractFrameManager::notifyFrameStart()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AbstractFrameManager::notifyFrameComplete(uInt32 finalScanlines)
void AbstractFrameManager::notifyFrameComplete()
{
myPreviousFrameFinalLines = myCurrentFrameFinalLines;
myCurrentFrameFinalLines = finalScanlines;
myCurrentFrameFinalLines = myCurrentFrameTotalLines;
myCurrentFrameTotalLines = 0;
myTotalFrames++;
if (myOnFrameComplete) myOnFrameComplete();

View File

@ -41,6 +41,10 @@ class AbstractFrameManager : public Serializable
callback renderingStartCallback
);
void reset();
void nextLine();
void setVblank(bool vblank);
void setVsync(bool vsync);
@ -77,10 +81,6 @@ class AbstractFrameManager : public Serializable
public:
virtual void reset() = 0;
virtual void nextLine() = 0;
virtual uInt32 height() const = 0;
virtual void setFixedHeight(uInt32 height) = 0;
@ -109,6 +109,10 @@ class AbstractFrameManager : public Serializable
virtual void onSetVsync() {}
virtual void onNextLine() {}
virtual void onReset() {}
virtual bool onSave(Serializer& out) const { throw runtime_error("cannot be serialized"); }
virtual bool onLoad(Serializer& in) { throw runtime_error("cannot be serialized"); }
@ -117,7 +121,7 @@ class AbstractFrameManager : public Serializable
void notifyFrameStart();
void notifyFrameComplete(uInt32 finalScanlines);
void notifyFrameComplete();
void notifyRenderingStart();
@ -129,6 +133,8 @@ class AbstractFrameManager : public Serializable
bool myVblank;
uInt32 myCurrentFrameTotalLines;
uInt32 myCurrentFrameFinalLines;
uInt32 myPreviousFrameFinalLines;