rigth now I try to make a small game with raylib and c++. Rigth now I only have a small cube and a plain window with the FPS in the corner. Becuase I doesnt wanted to use SetTargetFPS() I tried to implement deltaTime.
Rigth now I´m also calculating it and it works fine, when the FPS are stable, so for example: The cube moves at stable 200 FPS as fast as at stable 60 FPS, but when I get rid of SetTargetFPS(), so I have unstable FPS and the jump between 2000FPS and 1000FPS, The movement speed isn´t good.
I calculate the deltaTime so:
oldTime = newTime;
newTime = GetTime();
deltaTime = (newTime - oldTime) * 500;
That does also work and I have pretty similar numbers at the sma FPS.
And that is how I move things:
newPosX = posX + addX * deltaTime;
Does somebody know why this happens?
Thanks
I'm new to raylib but I believe the
GetFrameTime()
function is what you're looking for. This is the snippet in the cheat sheet: