From f59512c47ea21c851535eeabf822aabdfde9167f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 17 May 2013 00:18:09 +0300 Subject: RECORDER: Implement Events Recorder --- backends/platform/sdl/sdl.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'backends/platform/sdl/sdl.cpp') diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index d54854352d..77e6f73d48 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -30,7 +30,7 @@ #include "backends/platform/sdl/sdl.h" #include "common/config-manager.h" -#include "common/EventRecorder.h" +#include "gui/EventRecorder.h" #include "common/taskbar.h" #include "common/textconsole.h" @@ -97,7 +97,9 @@ OSystem_SDL::~OSystem_SDL() { _audiocdManager = 0; delete _mixerManager; _mixerManager = 0; - delete _timerManager; + + delete g_eventRec.getTimerManager(); + _timerManager = 0; delete _mutexManager; _mutexManager = 0; @@ -131,9 +133,6 @@ void OSystem_SDL::init() { if (_mutexManager == 0) _mutexManager = new SdlMutexManager(); - if (_timerManager == 0) - _timerManager = new SdlTimerManager(); - #if defined(USE_TASKBAR) if (_taskbarManager == 0) _taskbarManager = new Common::TaskbarManager(); @@ -191,10 +190,12 @@ void OSystem_SDL::initBackend() { if (_mixerManager == 0) { _mixerManager = new SdlMixerManager(); - // Setup and start mixer _mixerManager->init(); } + g_eventRec.registerMixerManager(_mixerManager); + + g_eventRec.registerTimerManager(new SdlTimerManager()); if (_audiocdManager == 0) { // Audio CD support was removed with SDL 1.3 @@ -466,14 +467,15 @@ void OSystem_SDL::setupIcon() { free(icon); } -uint32 OSystem_SDL::getMillis() { + +uint32 OSystem_SDL::getMillis(bool skipRecord) { uint32 millis = SDL_GetTicks(); - g_eventRec.processMillis(millis); + g_eventRec.processMillis(millis, skipRecord); return millis; } void OSystem_SDL::delayMillis(uint msecs) { - if (!g_eventRec.processDelayMillis(msecs)) + if (!g_eventRec.processDelayMillis()) SDL_Delay(msecs); } @@ -491,12 +493,12 @@ void OSystem_SDL::getTimeAndDate(TimeDate &td) const { Audio::Mixer *OSystem_SDL::getMixer() { assert(_mixerManager); - return _mixerManager->getMixer(); + return getMixerManager()->getMixer(); } SdlMixerManager *OSystem_SDL::getMixerManager() { assert(_mixerManager); - return _mixerManager; + return g_eventRec.getMixerManager(); } #ifdef USE_OPENGL @@ -654,4 +656,8 @@ void OSystem_SDL::setupGraphicsModes() { } } +Common::TimerManager *OSystem_SDL::getTimerManager() { + return g_eventRec.getTimerManager(); +} + #endif -- cgit v1.2.3 From 93fc2608859c9cb64f291eeacb766c53d4b55323 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 3 Jun 2013 02:25:22 +0200 Subject: SDL: Fix compilation by moving getMixerManager out of USE_OPENGL guard. --- backends/platform/sdl/sdl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'backends/platform/sdl/sdl.cpp') diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 77e6f73d48..f55dd277c7 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -501,6 +501,10 @@ SdlMixerManager *OSystem_SDL::getMixerManager() { return g_eventRec.getMixerManager(); } +Common::TimerManager *OSystem_SDL::getTimerManager() { + return g_eventRec.getTimerManager(); +} + #ifdef USE_OPENGL const OSystem::GraphicsMode *OSystem_SDL::getSupportedGraphicsModes() const { @@ -656,8 +660,4 @@ void OSystem_SDL::setupGraphicsModes() { } } -Common::TimerManager *OSystem_SDL::getTimerManager() { - return g_eventRec.getTimerManager(); -} - #endif -- cgit v1.2.3