diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2013-09-10 16:41:48 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:00:59 +0300 |
commit | 8a76d786cd4d7bd62103e9ddcfd276f15ce59dbd (patch) | |
tree | 1e9e4496c33601c74a377801c1abab4fc04821a2 /platform | |
parent | 0eca7c07eb095dd978112c522489817d3c5cd484 (diff) |
move EmptyVideoTimer to platform/video_timer.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/video_timer.cpp | 48 | ||||
-rw-r--r-- | platform/video_timer.hpp | 14 |
2 files changed, 62 insertions, 0 deletions
diff --git a/platform/video_timer.cpp b/platform/video_timer.cpp index 8f731f58a3..8a2fab5c9d 100644 --- a/platform/video_timer.cpp +++ b/platform/video_timer.cpp @@ -1,5 +1,7 @@ #include "video_timer.hpp" +#include "../std/bind.hpp" + VideoTimer::VideoTimer(TFrameFn fn) : m_frameFn(fn), m_state(EStopped) {} @@ -20,3 +22,49 @@ void VideoTimer::setFrameFn(TFrameFn fn) { m_frameFn = fn; } + +namespace +{ + void empty() {} +} + +EmptyVideoTimer::EmptyVideoTimer() + : base_t(bind(&empty)) +{ +} + +EmptyVideoTimer::~EmptyVideoTimer() +{ + stop(); +} + +void EmptyVideoTimer::start() +{ + if (m_state == EStopped) + m_state = ERunning; +} + +void EmptyVideoTimer::resume() +{ + if (m_state == EPaused) + { + m_state = EStopped; + start(); + } +} + +void EmptyVideoTimer::pause() +{ + stop(); + m_state = EPaused; +} + +void EmptyVideoTimer::stop() +{ + if (m_state == ERunning) + m_state = EStopped; +} + +void EmptyVideoTimer::perform() +{ +} diff --git a/platform/video_timer.hpp b/platform/video_timer.hpp index 58e4201f7c..b91c13736f 100644 --- a/platform/video_timer.hpp +++ b/platform/video_timer.hpp @@ -37,6 +37,20 @@ public: virtual void stop() = 0; }; +class EmptyVideoTimer : public VideoTimer +{ + typedef VideoTimer base_t; +public: + EmptyVideoTimer(); + ~EmptyVideoTimer(); + + void start(); + void resume(); + void pause(); + void stop(); + void perform(); +}; + extern "C" VideoTimer * CreateIOSVideoTimer(VideoTimer::TFrameFn frameFn); extern "C" VideoTimer * CreateAppleVideoTimer(VideoTimer::TFrameFn frameFn); extern "C" VideoTimer * CreateWin32VideoTimer(VideoTimer::TFrameFn frameFn); |