I am trying to create a timer that calls a function when the timer ends
this is the timer class
class CreateTimer{
float OverallLapsed;
float EndOfTimer;
bool Running;
public:
CreateTimer::CreateTimer(float);
void StartTimer();
void StopTimer();
void Lapsed(float);
void SetEndOfTimer(float);
bool CheckTimer();
void ResetOverallLapsed();
float GetOverallLapsed();
};
CreateTimer::CreateTimer(float EndTime){
EndOfTimer = EndTime;
OverallLapsed = 0;
Running = FALSE;
}
void CreateTimer::StartTimer(){Running = TRUE;}
void CreateTimer::StopTimer(){Running = FALSE;}
void CreateTimer::Lapsed(float Lapse){OverallLapsed += Lapse;}
void CreateTimer::SetEndOfTimer(float endtime){EndOfTimer = endtime;}
bool CreateTimer::CheckTimer(){
if (Running){
if (OverallLapsed >= EndOfTimer){return TRUE; OverallLapsed = 0.0f;}
else{return FALSE;}
}
else{return FALSE;}
}
float CreateTimer::GetOverallLapsed(){return OverallLapsed;}
void CreateTimer::ResetOverallLapsed(){OverallLapsed = 0.0f;}
I want to be able to give the function in the constructor
CreateTimer::CreateTimer(float,CALLBACK);
and I would like to call the function inside the CheckTimer function.
I know you can do that because I have used a timer that did that before but I cannot figure out how to.