Update main.cpp
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 1m39s

This commit is contained in:
2024-09-19 19:49:29 -04:00
parent 131ce4c78e
commit 4d761e874e

View File

@@ -11,6 +11,7 @@ using namespace JGL;
JGL::Font FreeSans;
JGL::Font Jupiteroid;
float fps = 0.0f;
class Gizmo
{
@@ -123,12 +124,8 @@ public:
float fov = 90;
float sprite_radians = 0;
bool fov_increasing = true;
std::chrono::high_resolution_clock::time_point start;
float fps = 0.0f;
void display() {
start = std::chrono::high_resolution_clock::now();
JGL::Update(getSize());
if (fov_increasing)
fov += 0.25;
@@ -202,10 +199,6 @@ public:
J2D::DrawRenderTargetAsSprite(*j2d_render_target, {0, 0}, 0, {0.5, 0.5}, {1,1}, Colors::White);
J2D::End();
*/
std::chrono::high_resolution_clock::time_point stop = std::chrono::high_resolution_clock::now();
std::chrono::duration<float> frame_time = stop - start;
fps = 1.0f / frame_time.count();
}
void OnRefresh(float elapsed) override {
@@ -251,11 +244,15 @@ int main(int argc, char** argv) {
window->Open();
window->initGL();
window->setResizable(true);
window->setVsyncEnabled(true);
window->setVsyncEnabled(false);
while (window->isAlive()) {
std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now();
window->pollEvents();
window->refresh();
std::chrono::high_resolution_clock::time_point stop = std::chrono::high_resolution_clock::now();
std::chrono::duration<float> frame_time = stop - start;
fps = 1.0f / frame_time.count();
}
return 0;
}