Ok, this is not specifically a coding question. I borrowed this code snippet from another thread somewhere around here and implemented it. If you look, I added 2 functions (myUPDATE and myDRAW).
My question is this -> in myUPDATE, I change the rotation of a sprite by a fraction, such as 0.05f. Changing this increases and decreases the speed of the rotation. Is this working correctly? I'm not sure I understand how this relates to keeping the framerate constant at 60fps. Please excuse me I've been at this for a long time, so I have never implemented something like this correctly.
My second question is this. Is this considered fixed timestep or variable timestep.
float dt = 1.f/60.f; // Modify this to change physics rate.
float accumulator = 0.f;
bool drawn = false;
while (App.IsOpened())
{
accumulator += clock.GetElapsedTime();
clock.Reset();
while (accumulator >= dt)
{
// Physics and gameplay updates.
myUPDATE();
accumulator -= dt;
drawn = false;
}
if (drawn)
{
sf::Sleep(0.01);
}
else
{
// Draw everything.
myDRAW();
drawn = true;
}
}