Blink image

Hi,
I would like implement a simple effect.
I wuold like blink a image, but I don’t know how can I use SDL_Ticks()
or SDL_AddTimer, for my purpose
tnx

//pseudo code
int nextswitch = 5; //blink every 5 frames
bool on = true; //start on
while (game runs){
if(on)
//draw pic
nextswitch–;
if(nextswitch == 0){
on = !on;
nextswitch = 5;
}
//insert framebreak for constant framerate here
}

that’s it.
if you want it time based instead of framebased then calculate
nextswitch using time.

NighTiger wrote:>Hi,

I would like implement a simple effect.
I wuold like blink a image, but I don’t know how can I use SDL_Ticks()
or SDL_AddTimer, for my purpose
tnx


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl