Added state and pause change notification methods to OSystem, so that

OSystem-derived classes can override these methods and deal with the
changes (much more useful than having the OSystemXXX classes constantly
poll the eventstate, etc.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1067 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-03-27 12:52:19 +00:00
parent 34f5abb314
commit 5a7df4c4cb
3 changed files with 30 additions and 4 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: EventHandler.cxx,v 1.157 2006-03-25 00:34:17 stephena Exp $
// $Id: EventHandler.cxx,v 1.158 2006-03-27 12:52:19 stephena Exp $
//============================================================================
#include <sstream>
@ -222,6 +222,9 @@ void EventHandler::pause(bool status)
myOSystem->frameBuffer().pause(myPauseFlag);
myOSystem->sound().mute(myPauseFlag);
// Inform the OSystem of the change in pause
myOSystem->pauseChanged(myPauseFlag);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -2125,6 +2128,9 @@ void EventHandler::setEventState(State state)
myOverlay = NULL;
break;
}
// Inform the OSystem about the new state
myOSystem->stateChanged(myState);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: OSystem.cxx,v 1.67 2006-03-25 00:34:17 stephena Exp $
// $Id: OSystem.cxx,v 1.68 2006-03-27 12:52:19 stephena Exp $
//============================================================================
#include <cassert>
@ -498,6 +498,16 @@ bool OSystem::joyButtonHandled(int button)
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::stateChanged(EventHandler::State state)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::pauseChanged(bool status)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystem::OSystem(const OSystem& osystem)
{

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: OSystem.hxx,v 1.41 2006-03-25 00:34:17 stephena Exp $
// $Id: OSystem.hxx,v 1.42 2006-03-27 12:52:19 stephena Exp $
//============================================================================
#ifndef OSYSTEM_HXX
@ -44,7 +44,7 @@ class CheatManager;
other objects belong.
@author Stephen Anthony
@version $Id: OSystem.hxx,v 1.41 2006-03-25 00:34:17 stephena Exp $
@version $Id: OSystem.hxx,v 1.42 2006-03-27 12:52:19 stephena Exp $
*/
class OSystem
{
@ -353,6 +353,16 @@ class OSystem
*/
virtual bool joyButtonHandled(int button);
/**
Informs the OSystem of a change in EventHandler state.
*/
virtual void stateChanged(EventHandler::State state);
/**
Informs the OSystem of a change in pause status.
*/
virtual void pauseChanged(bool status);
protected:
/**
Set the base directory for all Stella files