SDL_timer.h
Función SDL_RemoveTimer
Sintaxis
SDL_bool SDL_RemoveTimer(SDL_TimerID id);
Descripción
Elimina un temporizador creado con SDL_AddTimer().
Parámetros
- id
- El Id del temporizador a eliminar.
Valor de retorno
Devuelve SDL_TRUE si el temporizador es eliminado o SDL_FALSE si el temporizador no fue encontrado.
Ejemplo
// Function to be called after a certain time
Uint32 callback(Uint32 interval, void* name) {
printf("Hello %s!\n", static_cast<char*>(name));
return 0;
}
...
// Initialize timer
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
...
// Set timer to 1 second
SDL_TimerID timerID = SDL_AddTimer(1000, callback, const_cast<char*>("SDL"));
// Main loop
while(!quit) {
...
}
// Remove timer after main loop
SDL_RemoveTimer(timerID);