From 5a7df4c4cb2aad55c48d03e4e1326355cbae71fa Mon Sep 17 00:00:00 2001 From: stephena Date: Mon, 27 Mar 2006 12:52:19 +0000 Subject: [PATCH] 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 --- stella/src/emucore/EventHandler.cxx | 8 +++++++- stella/src/emucore/OSystem.cxx | 12 +++++++++++- stella/src/emucore/OSystem.hxx | 14 ++++++++++++-- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index 9993c8a8d..c8cbaf474 100644 --- a/stella/src/emucore/EventHandler.cxx +++ b/stella/src/emucore/EventHandler.cxx @@ -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 @@ -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); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/OSystem.cxx b/stella/src/emucore/OSystem.cxx index 1b01a280e..863cf7768 100644 --- a/stella/src/emucore/OSystem.cxx +++ b/stella/src/emucore/OSystem.cxx @@ -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 @@ -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) { diff --git a/stella/src/emucore/OSystem.hxx b/stella/src/emucore/OSystem.hxx index 7b99c926e..a0c8631d6 100644 --- a/stella/src/emucore/OSystem.hxx +++ b/stella/src/emucore/OSystem.hxx @@ -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