Skip to content

Commit a2dec54

Browse files
author
Rodrigo Oliveira
committed
Merge pull request #19 from rogerzanoni/fps
Adjusting FPS is working now
2 parents c693e24 + 25b614f commit a2dec54

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/game.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
Game::Game(QuasiDeclarativeItem *parent)
3535
: QuasiDeclarativeItem(parent)
3636
, m_currentScene(0)
37-
, m_fps(60)
37+
, m_fps(30)
3838
, m_timerId(0)
3939
{
4040
m_gameTime.start();
@@ -83,6 +83,10 @@ void Game::setFps(const int &fps)
8383

8484
m_fps = fps;
8585

86+
killTimer(m_timerId);
87+
m_gameTime.restart();
88+
m_timerId = startTimer(1000 / m_fps);
89+
8690
emit fpsChanged();
8791
}
8892

0 commit comments

Comments
 (0)