Hi! I know alarms are easy to setup using dbTimer() but I thought it would be cool to have a class to make it easier, to read, and to add some other easy to use commands. I also just wanted to practice some C++ skills and not necessarily DarkGDK. So anyway I've attached an example along with the header and source.
The include file in Alarms.cpp is not needed with your project for it's installed in the VC++ include folder on installation. Because this doesn't use DarkGDK you can use this class in things like Irrlicht and Ogre. (I think they both use C++)
To Use:
Copy the Alarms.h and Alarms.cpp files to your project director
Add this include line:
To set an alarm simply do:
Alarms.SetAlarm ( Alarm Number, Time In Seconds );
To check if an alarm went off do:
if ( Alarms.AlarmWentOff ( Alarm Number ) )
{
//Other code here
}
Full Command List:
//Sets an alarm for set amount of seconds
void Alarms.SetAlarm ( int AlarmNum, int Seconds );
//Stops and alarm
void Alarms.StopAlarm ( int AlarmNum );
//Checks if an alarm went off
bool Alarms.WentOff ( int AlarmNum );
//Checks if an alarm is set (useful to avoid resetting an alarm)
bool Alarms.AlarmSet ( int AlarmNum );
Enjoy, and please let me know if this is useful or not!
Use Google first... it's not rocket surgery!