Changed the behaviour of pause() wrt the FrameBuffer. Now the base

FrameBuffer class is paused, and *it* notifies the child class of
this event.  Previously, the code for pausing the parent class
had to be provided by the child, meaning that if the derived
classes of FrameBuffer didn't provide it, then the emulation
core would not pause.  This is exactly what happened to me
in the Windows version, and I spent 10 minutes trying to figure
out why pause wasn't working :)


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@204 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2003-11-12 19:36:25 +00:00
parent 505a38057d
commit 9d2e1cfcc0
4 changed files with 35 additions and 18 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBuffer.cxx,v 1.4 2003-11-09 23:53:19 stephena Exp $
// $Id: FrameBuffer.cxx,v 1.5 2003-11-12 19:36:25 stephena Exp $
//============================================================================
#include <sstream>
@ -50,10 +50,10 @@ FrameBuffer::FrameBuffer()
myWidth(160),
myHeight(300),
theRedrawEntireFrameIndicator(true),
myPauseStatus(false),
myFGColor(10),
myBGColor(0),
myFrameRate(0),
myPauseStatus(false),
myCurrentWidget(W_NONE),
myRemapEventSelectedFlag(false),
mySelectedEvent(Event::NoType),
@ -449,6 +449,16 @@ MediaSource* FrameBuffer::mediaSource() const
return (MediaSource*) NULL;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::pause(bool status)
{
myPauseStatus = status;
// Now notify the child object, in case it wants to do something
// special when pause is received
pauseEvent(myPauseStatus);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBuffer::Widget FrameBuffer::currentSelectedWidget()
{

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBuffer.hxx,v 1.4 2003-11-09 23:53:19 stephena Exp $
// $Id: FrameBuffer.hxx,v 1.5 2003-11-12 19:36:25 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_HXX
@ -35,7 +35,7 @@ class Console;
can be changed.
@author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.4 2003-11-09 23:53:19 stephena Exp $
@version $Id: FrameBuffer.hxx,v 1.5 2003-11-12 19:36:25 stephena Exp $
*/
class FrameBuffer
{
@ -120,6 +120,14 @@ class FrameBuffer
*/
MediaSource* mediaSource() const;
/**
Sets the pause status. While pause is selected, the
MediaSource will not be updated.
@param status Toggle pause based on status
*/
void pause(bool status);
public:
//////////////////////////////////////////////////////////////////////
// The following methods are system-specific and must be implemented
@ -179,11 +187,12 @@ class FrameBuffer
virtual void postFrameUpdate() = 0;
/**
This routine is called when the emulation has been paused.
This routine is called when the emulation has received
a pause event.
@param status Toggle pause based on status
@param status The received pause status
*/
virtual void pause(bool status) = 0;
virtual void pauseEvent(bool status) = 0;
protected:
// The Console for the system
@ -198,9 +207,6 @@ class FrameBuffer
// Indicates if the entire frame should be redrawn
bool theRedrawEntireFrameIndicator;
// Indicates the current pause status
bool myPauseStatus;
// Table of bitmapped fonts.
static const uInt8 ourFontData[2048];
@ -246,6 +252,9 @@ class FrameBuffer
// Indicates the current framerate of the system
uInt32 myFrameRate;
// Indicates the current pause status
bool myPauseStatus;
// Structure used for main menu items
struct MainMenuItem
{

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferSDL.cxx,v 1.3 2003-11-09 23:53:20 stephena Exp $
// $Id: FrameBufferSDL.cxx,v 1.4 2003-11-12 19:36:25 stephena Exp $
//============================================================================
#include <SDL.h>
@ -43,12 +43,10 @@ FrameBufferSDL::~FrameBufferSDL()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL::pause(bool status)
void FrameBufferSDL::pauseEvent(bool status)
{
myPauseStatus = status;
// Shade the palette to 75% normal value in pause mode
if(myPauseStatus)
if(status)
setupPalette(0.75);
else
setupPalette(1.0);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferSDL.hxx,v 1.3 2003-11-09 23:53:20 stephena Exp $
// $Id: FrameBufferSDL.hxx,v 1.4 2003-11-12 19:36:25 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_SDL_HXX
@ -34,7 +34,7 @@
the core FrameBuffer.
@author Stephen Anthony
@version $Id: FrameBufferSDL.hxx,v 1.3 2003-11-09 23:53:20 stephena Exp $
@version $Id: FrameBufferSDL.hxx,v 1.4 2003-11-12 19:36:25 stephena Exp $
*/
class FrameBufferSDL : public FrameBuffer
{
@ -100,7 +100,7 @@ class FrameBufferSDL : public FrameBuffer
@param status Toggle pause based on status
*/
void pause(bool status);
void pauseEvent(bool status);
//////////////////////////////////////////////////////////////////////
// The following methods must be defined in child classes