mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-01 01:38:14 +00:00
add fps limit on window at construction
This commit is contained in:
@@ -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);
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user