Renamed Time.cpp to Manager.cpp for clarity

This commit is contained in:
2025-10-07 12:09:48 +03:00
parent fb82db0017
commit cc39fd31e8
4 changed files with 14 additions and 14 deletions

View File

@@ -28,7 +28,7 @@ pkg_check_modules(AVUTIL REQUIRED libavutil)
pkg_check_modules(SWSCALE REQUIRED libswscale) pkg_check_modules(SWSCALE REQUIRED libswscale)
pkg_check_modules(SWRESAMPLE REQUIRED libswresample) 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") "src/Video.cpp")
target_link_libraries( target_link_libraries(

View File

@@ -38,7 +38,7 @@ using namespace Corrade;
using namespace Magnum; using namespace Magnum;
using namespace Math::Literals; using namespace Math::Literals;
// ======================== CLASSES ======================== // ======================== CLASSES ========================
class Time { class Manager {
public: public:
static void AdvanceTime(); static void AdvanceTime();
static float DeltaTime; static float DeltaTime;

View File

@@ -4,16 +4,16 @@
using namespace ChargeVideo; using namespace ChargeVideo;
// ================== Video Timing ================== // ================== Video Managing ==================
float Time::DeltaTime = 0.0f; float Manager::DeltaTime = 0.0f;
uint16_t Time::videoIDCounter = 0; uint16_t Manager::videoIDCounter = 0;
std::unordered_map<uint16_t, std::function<void()>> Time::videoPlayMethods; std::unordered_map<uint16_t, std::function<void()>> Manager::videoPlayMethods;
std::vector<uint16_t> Time::toUnhook; std::vector<uint16_t> Manager::toUnhook;
Timeline Time::time{}; Timeline Manager::time{};
void Time::AdvanceTime() { void Manager::AdvanceTime() {
if (time.currentFrameTime() == 0.0f) { if (time.currentFrameTime() == 0.0f) {
time.start(); time.start();
} }
@@ -30,9 +30,9 @@ void Time::AdvanceTime() {
time.nextFrame(); time.nextFrame();
} }
uint16_t Time::hookVideo(std::function<void()> videoPlay) { uint16_t Manager::hookVideo(std::function<void()> videoPlay) {
videoPlayMethods.insert({++videoIDCounter, videoPlay}); videoPlayMethods.insert({++videoIDCounter, videoPlay});
return videoIDCounter; return videoIDCounter;
} }
void Time::unhookVideo(uint16_t ID) { toUnhook.push_back(ID); } void Manager::unhookVideo(uint16_t ID) { toUnhook.push_back(ID); }

View File

@@ -121,7 +121,7 @@ void Video::Play() {
if (ID != 0) { if (ID != 0) {
return; return;
} }
ID = Time::hookVideo(std::bind(&Video::continueVideo, this)); ID = Manager::hookVideo(std::bind(&Video::continueVideo, this));
if (audioStreamNum != -1) { if (audioStreamNum != -1) {
Sound->Play(); Sound->Play();
} }
@@ -133,7 +133,7 @@ void Video::Pause() {
if (ID == 0) { if (ID == 0) {
return; return;
} }
Time::unhookVideo(ID); Manager::unhookVideo(ID);
if (audioStreamNum != -1) { if (audioStreamNum != -1) {
Sound->Pause(); Sound->Pause();
} }
@@ -170,7 +170,7 @@ void Video::continueVideo() {
clock = clock =
(double)Sound->GetPlayedSampleCount() / audioEngine->GetSampleRate(); (double)Sound->GetPlayedSampleCount() / audioEngine->GetSampleRate();
} else { } else {
clock += Time::DeltaTime; clock += Manager::DeltaTime;
} }
// Load frame // Load frame