diff options
author | richiesams | 2013-08-04 23:54:53 -0500 |
---|---|---|
committer | richiesams | 2013-08-05 00:05:14 -0500 |
commit | ec7036469c57eecb7afb226cc3dd176fcc74c0cb (patch) | |
tree | 6c6e69e7fc83c4995769aa7e0865743c6892d979 | |
parent | c4dc3989a70939fd98f1d55dffb548e68f80adfb (diff) | |
download | scummvm-rg350-ec7036469c57eecb7afb226cc3dd176fcc74c0cb.tar.gz scummvm-rg350-ec7036469c57eecb7afb226cc3dd176fcc74c0cb.tar.bz2 scummvm-rg350-ec7036469c57eecb7afb226cc3dd176fcc74c0cb.zip |
ZVISION: Make _clock a member variable instead of a pointer to the heap
-rw-r--r-- | engines/zvision/video.cpp | 8 | ||||
-rw-r--r-- | engines/zvision/zvision.cpp | 13 | ||||
-rw-r--r-- | engines/zvision/zvision.h | 4 |
3 files changed, 11 insertions, 14 deletions
diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 8550a6cfca..51cccee639 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -94,13 +94,13 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder) { uint16 x = (_width - finalWidth) / 2; uint16 y = (_height - finalHeight) / 2; - _clock->stop(); + _clock.stop(); videoDecoder.start(); // Only continue while the video is still playing while (videoDecoder.isPlaying()) { - _clock->update(); - uint32 currentTime = _clock->getLastMeasuredTime(); + _clock.update(); + uint32 currentTime = _clock.getLastMeasuredTime(); // Check for engine quit and video stop key presses while (_eventMan->pollEvent(_event)) { @@ -140,7 +140,7 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder) { _system->delayMillis(delay); } - _clock->stop(); + _clock.stop(); // Reset the pixel format to the original state initGraphics(_width, _height, true, &_pixelFormat); diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 0015c41499..f406b5e852 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -52,7 +52,8 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) _width(640), _height(480), _pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), /*RGB 555*/ - _desiredFrameTime(33) /* ~30 fps */ { + _desiredFrameTime(33), /* ~30 fps */ + _clock(_system) { // Put your engine in a sane state, but do nothing big yet; // in particular, do not load data from files; rather, if you // need to do such things, do them from run(). @@ -80,9 +81,6 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) _scriptManager = new ScriptManager(this); _renderManager = new RenderManager(_system, _width, _height); - // Create clock - _clock = new Clock(_system); - debug("ZVision::ZVision"); } @@ -91,7 +89,6 @@ ZVision::~ZVision() { // Dispose of resources delete _console; - delete _clock; delete _renderManager; delete _scriptManager; delete _rnd; @@ -126,12 +123,12 @@ Common::Error ZVision::run() { // Main loop while (!shouldQuit()) { - _clock->update(); - uint32 currentTime = _clock->getLastMeasuredTime(); + _clock.update(); + uint32 currentTime = _clock.getLastMeasuredTime(); processEvents(); - _scriptManager->updateNodes(_clock->getDeltaTime()); + _scriptManager->updateNodes(_clock.getDeltaTime()); _scriptManager->checkPuzzleCriteria(); // Render a frame diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 459096a03b..3eff16e5f1 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -32,6 +32,7 @@ #include "graphics/pixelformat.h" #include "zvision/detection.h" +#include "zvision/clock.h" #include "gui/debugger.h" @@ -46,7 +47,6 @@ struct ZVisionGameDescription; class Console; class ScriptManager; class RenderManager; -class Clock; // our engine debug channels enum { @@ -78,7 +78,7 @@ private: RenderManager *_renderManager; // Clock - Clock *_clock; + Clock _clock; // To prevent allocation every time we process events Common::Event _event; |