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" #include "AbstractFrameManager.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFrameManager::AbstractFrameManager() : AbstractFrameManager::AbstractFrameManager()
myIsRendering(false), {
myVsync(false), reset();
myVblank(false), }
myCurrentFrameFinalLines(0),
myPreviousFrameFinalLines(0), // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
myTotalFrames(0), void AbstractFrameManager::reset()
myLayout(FrameLayout::ntsc), {
myFrameRate(0), myIsRendering = false;
myOnFrameComplete(0), myVsync = false;
myOnFrameStart(0), myVblank = false;
myOnRenderingStart(0) 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( void AbstractFrameManager::setHandlers(
@ -70,10 +88,11 @@ void AbstractFrameManager::notifyFrameStart()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AbstractFrameManager::notifyFrameComplete(uInt32 finalScanlines) void AbstractFrameManager::notifyFrameComplete()
{ {
myPreviousFrameFinalLines = myCurrentFrameFinalLines; myPreviousFrameFinalLines = myCurrentFrameFinalLines;
myCurrentFrameFinalLines = finalScanlines; myCurrentFrameFinalLines = myCurrentFrameTotalLines;
myCurrentFrameTotalLines = 0;
myTotalFrames++; myTotalFrames++;
if (myOnFrameComplete) myOnFrameComplete(); if (myOnFrameComplete) myOnFrameComplete();

View File

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