There are many solutions to this, but ultimately you've got something that decides each time around the game loop, when drawing the frame on screen, whether or not to draw that item on the screen.
The most obvious way to do this that comes to mind is for the item to be an object that carries its own lifetime. Something really simple like this:
1 2 3 4 5
|
class objectToDrawOnScreen
{
TICK_TYPE tickTimeToDestroyThisObject;
// and all the drawing information and location etc
}
|
The objectToDrawOnScreen knows its own lifetime. When you create it, you set
tickTimeToDestroyThisObject
to "now plus five seconds".
Stick all those in a vector as they get created, and each time round the game loop when drawing the frame on screen, that vector is iterated over. If the current tick time exceed an object's tickTimeToDestroyThisObject, you don't draw it - you erase it from the vector. Otherwise, you draw it.
Nine times out of ten, simple is better, and the other one time out of ten, you've misunderstood the issue. Timers not necessary, no callbacks required.