Hey guys, I am trying to make my game run with delta time, but I am
1) either running into problems
2) not doing it right, which would take us back to number 1 :p
I am coding in SDL and what I am doing here is calling Process with delta time,
Tick is the current ticks, and previous time is set at the end of the frame. Game_Speed is defined at 60, and divided by 1000 because it is in miliseconds.
int Ticks = GameTimer.get_ticks();
CurrentState->Process(GameObjects, (((Ticks - PreviousTime) * GAME_SPEED) / 1000));
At the end of the tick function this is in, I set previoustime to current ticks.
PreviousTime = GameTimer.get_ticks();
Ok, inside process I am trying to make a object fade in... but it doesn't seem to want to work.. I don't know what I am doing wrong, I have been trying solve it for a while and now it's just getting annoying.
static int alpha = 0;
alpha += 25 * DeltaTime;
SDL_SetAlpha(Objects["Title"]->Surface, SDL_SRCALPHA, alpha);
If there is anything else you might want to know, just drop a reply.. thanks :D.
Regards, Fouf.