+ | FPS ~ | Single triangle shader

This commit is contained in:
TheRedShip
2024-10-15 01:10:57 +02:00
parent 9d7a30800e
commit 1c25a29c38
4 changed files with 27 additions and 9 deletions

View File

@ -85,9 +85,15 @@ void Window::mouseButtonCallback(GLFWwindow* window, int button, int action, int
}
}
void Window::display()
{
static double lastTime = glfwGetTime();
double currentTime = glfwGetTime();
double delta = currentTime - lastTime;
lastTime = currentTime;
_fps = 1.0f / delta;
glfwSwapBuffers(_window);
}
void Window::pollEvents()
@ -107,3 +113,8 @@ RT::Vec2i Window::getMousePos(void) const
{
return (_mousePos);
}
float Window::getFps(void) const
{
return (_fps);
}