Added FPS cap, added Optimus support, and removed showWindow requirement
This commit is contained in:
1 parent
2eb8d55a1c
commit
efeec66fad
5 files changed
+85
-35
No files matched your search
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include "Config.h"
|
||||
#include <Windows.h>
|
||||
#include <chrono>
|
||||
#include <vector>
|
||||
|
||||
namespace nf {
|
||||
class Application {
|
||||
@@ -14,6 +16,7 @@ namespace nf {
|
||||
void startLoop();
|
||||
void showWindow(bool show);
|
||||
Config& getConfig();
|
||||
int getFPS();
|
||||
|
||||
~Application();
|
||||
private:
|
||||
@@ -33,5 +36,17 @@ namespace nf {
|
||||
WINDOWPLACEMENT m_wndPlacement;
|
||||
HDC m_hdc;
|
||||
HGLRC m_hglrc;
|
||||
|
||||
std::chrono::steady_clock::time_point m_frameClock = std::chrono::steady_clock::now();
|
||||
std::chrono::duration<double> m_fpsDuration;
|
||||
double m_deltaTime;
|
||||
std::chrono::steady_clock::time_point m_fpsClock1 = m_frameClock;
|
||||
std::chrono::steady_clock::time_point m_fpsClock2 = m_frameClock;
|
||||
int m_frames;
|
||||
const int m_targetFPS = 60;
|
||||
const double m_minFrametime = 1.0 / m_targetFPS;
|
||||
int m_FPS;
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
@@ -21,6 +21,8 @@ DebugBreak();
|
||||
public:
|
||||
static void LogImp(const char* in);
|
||||
static void LogImp(const std::string& in);
|
||||
static void LogImp(int in);
|
||||
static void LogImp(double in);
|
||||
static void ErrorImp(const char* in, const char* filename, int line);
|
||||
};
|
||||
#else
|
||||
|
||||
Reference in new issue
Block a user