diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c5cbf1..ba775bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ pkg_check_modules(AVUTIL REQUIRED libavutil) pkg_check_modules(SWSCALE REQUIRED libswscale) pkg_check_modules(SWRESAMPLE REQUIRED libswresample) -add_library(ChargeVideo SHARED "src/ChargeVideo.hpp" "src/Time.cpp" +add_library(ChargeVideo SHARED "src/ChargeVideo.hpp" "src/Manager.cpp" "src/Video.cpp") target_link_libraries( diff --git a/src/ChargeVideo.hpp b/src/ChargeVideo.hpp index 1375e01..56be467 100644 --- a/src/ChargeVideo.hpp +++ b/src/ChargeVideo.hpp @@ -38,7 +38,7 @@ using namespace Corrade; using namespace Magnum; using namespace Math::Literals; // ======================== CLASSES ======================== -class Time { +class Manager { public: static void AdvanceTime(); static float DeltaTime; diff --git a/src/Time.cpp b/src/Manager.cpp similarity index 52% rename from src/Time.cpp rename to src/Manager.cpp index 3c400ed..47b67a4 100644 --- a/src/Time.cpp +++ b/src/Manager.cpp @@ -4,16 +4,16 @@ using namespace ChargeVideo; -// ================== Video Timing ================== -float Time::DeltaTime = 0.0f; -uint16_t Time::videoIDCounter = 0; +// ================== Video Managing ================== +float Manager::DeltaTime = 0.0f; +uint16_t Manager::videoIDCounter = 0; -std::unordered_map> Time::videoPlayMethods; -std::vector Time::toUnhook; +std::unordered_map> Manager::videoPlayMethods; +std::vector Manager::toUnhook; -Timeline Time::time{}; +Timeline Manager::time{}; -void Time::AdvanceTime() { +void Manager::AdvanceTime() { if (time.currentFrameTime() == 0.0f) { time.start(); } @@ -30,9 +30,9 @@ void Time::AdvanceTime() { time.nextFrame(); } -uint16_t Time::hookVideo(std::function videoPlay) { +uint16_t Manager::hookVideo(std::function videoPlay) { videoPlayMethods.insert({++videoIDCounter, videoPlay}); return videoIDCounter; } -void Time::unhookVideo(uint16_t ID) { toUnhook.push_back(ID); } +void Manager::unhookVideo(uint16_t ID) { toUnhook.push_back(ID); } diff --git a/src/Video.cpp b/src/Video.cpp index 9a8fba4..de0d53a 100644 --- a/src/Video.cpp +++ b/src/Video.cpp @@ -121,7 +121,7 @@ void Video::Play() { if (ID != 0) { return; } - ID = Time::hookVideo(std::bind(&Video::continueVideo, this)); + ID = Manager::hookVideo(std::bind(&Video::continueVideo, this)); if (audioStreamNum != -1) { Sound->Play(); } @@ -133,7 +133,7 @@ void Video::Pause() { if (ID == 0) { return; } - Time::unhookVideo(ID); + Manager::unhookVideo(ID); if (audioStreamNum != -1) { Sound->Pause(); } @@ -170,7 +170,7 @@ void Video::continueVideo() { clock = (double)Sound->GetPlayedSampleCount() / audioEngine->GetSampleRate(); } else { - clock += Time::DeltaTime; + clock += Manager::DeltaTime; } // Load frame