Kaynağa Gözat

"float Time::GetFramesPerSecond() const" API

Rokas Kupstys 8 yıl önce
ebeveyn
işleme
fe1a20025f
2 değiştirilmiş dosya ile 8 ekleme ve 0 silme
  1. 5 0
      Source/Urho3D/Core/Timer.cpp
  2. 3 0
      Source/Urho3D/Core/Timer.h

+ 5 - 0
Source/Urho3D/Core/Timer.cpp

@@ -189,6 +189,11 @@ void Time::Sleep(unsigned mSec)
 #endif
 #endif
 }
 }
 
 
+float Time::GetFramesPerSecond() const
+{
+    return 1.0f / timeStep_;
+}
+
 Timer::Timer()
 Timer::Timer()
 {
 {
     Reset();
     Reset();

+ 3 - 0
Source/Urho3D/Core/Timer.h

@@ -104,6 +104,9 @@ public:
     /// Return elapsed time from program start as seconds.
     /// Return elapsed time from program start as seconds.
     float GetElapsedTime();
     float GetElapsedTime();
 
 
+    /// Return current frames per second.
+    float GetFramesPerSecond() const;
+
     /// Get system time as milliseconds.
     /// Get system time as milliseconds.
     static unsigned GetSystemTime();
     static unsigned GetSystemTime();
     /// Get system time as seconds since 1.1.1970.
     /// Get system time as seconds since 1.1.1970.