add fps limit on window at construction

This commit is contained in:
arthur.jamet
2021-06-01 13:40:43 +02:00
parent 01bcf4b34a
commit 573ab3fd92
4 changed files with 15 additions and 1 deletions
+5
View File
@@ -167,3 +167,8 @@ void RAY::Window::setIcon(RAY::Image &img)
{
SetWindowIcon(img);
}
void RAY::Window::drawFPS(const RAY::Vector2 &position)
{
DrawFPS(position.x, position.y);
}
+3
View File
@@ -131,6 +131,9 @@ namespace RAY {
//! @brief Draw a 3d mesh with material and transform
void draw(const Mesh &mesh, const Material &material, const Matrix &transform);
//! @brief Draws current FPS on the frame
void drawFPS(const Vector2 &position);
private:
//! @brief Creates window, and opens it if openNow is set to true
@@ -15,10 +15,13 @@ namespace BBM
}),
_window(window),
_camera(Vector3f(), Vector3f(), Vector3f(0, 1, 0), 50, CAMERA_PERSPECTIVE)
{}
{
this->_window.setFPS(RenderScreenSystem::FPS);
}
void RenderScreenSystem::onSelfUpdate()
{
this->_window.drawFPS(RAY::Vector2(1, 1));
this->_window.draw();
this->_window.clear();
this->_window.useCamera(this->_camera);
@@ -17,6 +17,9 @@ namespace BBM
//! @brief The camera used to render.
RAY::Camera::Camera3D _camera;
//! @brief Window framerate limit
static constexpr short FPS = 30;
public:
//! @brief A method called after all entities that this system manage has been updated.
//! @note render on screen here