Delta time calculation problem

Hello.
Curnently last few hours im readin the "Delta Time".
Im trying to use so called "Fixed Time Step" method in my game, but only thing it was is pain in the $$$.
cant find something simple, each article is som hardcore calculations and stuff.
Ex: im looking for something like this: & im using SDL to get time
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
int main[]
{
   float CurrentTime;
   float LastTime;
   float SpeedFactor;
   bool On = true;
 while(On)  // main game loop
 {
  LastTime = CurrentTime;
  CurrentTime = SDL_GetTicks();
  SpeedFactor = ?
  //events
  Actions(SpeedFactor); //actions
  //render
  
 }
}

void Actions(float SpeedFactor)
{
 MyUnitPosition.x = 1.f * SpeedFactor;
}

basicly i need that speed factor cause i got about 20 movment calculations per loop
Last edited on
Topic archived. No new replies allowed.