From e24d28681b3dc8c4fa699a58f3bdf51d61647931 Mon Sep 17 00:00:00 2001 From: tyanmahou Date: Thu, 4 Jan 2024 21:47:10 +0900 Subject: [PATCH] remove FrameRateHz --- Re-Abyss/app/utils/FPS/FrameRateHz.cpp | 25 --------------------- Re-Abyss/app/utils/FPS/FrameRateHz.hpp | 30 -------------------------- 2 files changed, 55 deletions(-) delete mode 100644 Re-Abyss/app/utils/FPS/FrameRateHz.cpp delete mode 100644 Re-Abyss/app/utils/FPS/FrameRateHz.hpp diff --git a/Re-Abyss/app/utils/FPS/FrameRateHz.cpp b/Re-Abyss/app/utils/FPS/FrameRateHz.cpp deleted file mode 100644 index 3d68470ee..000000000 --- a/Re-Abyss/app/utils/FPS/FrameRateHz.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -namespace abyss -{ - void FrameRateHz::set(const s3d::Optional& value) - { - m_value = value; - auto refreshRate = s3d::System::GetCurrentMonitor().refreshRate.map([](double x) { - return Fps{ x }; - }); - if (value && refreshRate && *refreshRate >= *value) { - m_sleepTime = value->duration(); - s3d::Graphics::SetVSyncEnabled(false); - } else { - m_sleepTime = s3d::none; - s3d::Graphics::SetVSyncEnabled(true); - } - } - void FrameRateHz::sleep() const - { - if (m_sleepTime) { - s3d::System::Sleep(*m_sleepTime); - } - } -} diff --git a/Re-Abyss/app/utils/FPS/FrameRateHz.hpp b/Re-Abyss/app/utils/FPS/FrameRateHz.hpp deleted file mode 100644 index 908e965d1..000000000 --- a/Re-Abyss/app/utils/FPS/FrameRateHz.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once -#include -#include -#include - -namespace abyss -{ - class FrameRateHz : protected Singleton - { - public: - static void Set(s3d::Optional value) - { - Instance()->set(value); - } - static void Sleep() - { - Instance()->sleep(); - } - private: - friend class Singleton; - private: - FrameRateHz() = default; - - void set(const s3d::Optional& value); - void sleep() const; - - s3d::Optional m_value; - s3d::Optional m_sleepTime; - }; -}