SUNENGINE 0.0.2
A simple and bright C++ game engine.
 
Loading...
Searching...
No Matches
Alarmable Class Reference

Base class for objects that can have alarms triggered in the game loop. More...

#include <Alarmable.h>

Inheritance diagram for Alarmable:
Inheritance graph

Classes

struct  RegistrationData
 Structure to hold registration data for alarms. More...
 

Protected Member Functions

 Alarmable (const Alarmable &)=delete
 
Alarmableoperator= (const Alarmable &)=delete
 
void SubmitAlarmRegistration (AlarmableManager::ALARM_ID id, float t)
 Submits the alarm registration for the GameObject.
 
void SubmitAlarmDeregistration (AlarmableManager::ALARM_ID id)
 Submits the alarm deregistration for the GameObject.
 
bool IsAlarmRegistered (AlarmableManager::ALARM_ID id)
 Checks if the given alarm is currently registered.
 

Private Member Functions

virtual void Alarm0 ()
 Virtual method to be implemented by derived classes for alarm 0 when triggered.
 
virtual void Alarm1 ()
 Virtual method to be implemented by derived classes for alarm 1 when triggered.
 
virtual void Alarm2 ()
 Virtual method to be implemented by derived classes for alarm 2 when triggered.
 
void AlarmRegistration (AlarmableManager::ALARM_ID id, float t)
 Registers the GameObject for alarms in the scene.
 
void AlarmDeregistration (AlarmableManager::ALARM_ID id)
 Deregisters the GameObject from alarms in the scene.
 
void TriggerAlarm (AlarmableManager::ALARM_ID id)
 Triggers the alarm for the GameObject.
 
int GetAlarmRegInt (AlarmableManager::ALARM_ID id)
 Gets the integer representation of the alarm registration state.
 

Private Attributes

RegistrationData RegData [AlarmableManager::ALARM_NUMBER]
 Array to hold registration data for all alarms.
 

Friends

class AlarmableAttorney
 

Detailed Description

Base class for objects that can have alarms triggered in the game loop.

The Alarmable class provides a base implementation for objects that need to have alarms triggered during the game loop. It manages registration and deregistration with the AlarmableManager and provides virtual alarm methods that can be overridden by derived classes.

Member Function Documentation

◆ AlarmDeregistration()

void Alarmable::AlarmDeregistration ( AlarmableManager::ALARM_ID id)
private

Deregisters the GameObject from alarms in the scene.

Parameters
idThe alarm ID to deregister.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AlarmRegistration()

void Alarmable::AlarmRegistration ( AlarmableManager::ALARM_ID id,
float t )
private

Registers the GameObject for alarms in the scene.

Parameters
idThe alarm ID to register.
tThe time duration for the alarm.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAlarmRegInt()

int Alarmable::GetAlarmRegInt ( AlarmableManager::ALARM_ID id)
private

Gets the integer representation of the alarm registration state.

Parameters
idThe alarm ID.
Returns
The integer representation of the alarm registration state.
Here is the caller graph for this function:

◆ IsAlarmRegistered()

bool Alarmable::IsAlarmRegistered ( AlarmableManager::ALARM_ID id)
protected

Checks if the given alarm is currently registered.

Parameters
idThe alarm ID to check.
Returns
True if the alarm is currently registered, false otherwise.
Here is the call graph for this function:

◆ SubmitAlarmDeregistration()

void Alarmable::SubmitAlarmDeregistration ( AlarmableManager::ALARM_ID id)
protected

Submits the alarm deregistration for the GameObject.

Parameters
idThe alarm ID to deregister.
Here is the call graph for this function:

◆ SubmitAlarmRegistration()

void Alarmable::SubmitAlarmRegistration ( AlarmableManager::ALARM_ID id,
float t )
protected

Submits the alarm registration for the GameObject.

Parameters
idThe alarm ID to register.
tThe time duration for the alarm.
Here is the call graph for this function:

◆ TriggerAlarm()

void Alarmable::TriggerAlarm ( AlarmableManager::ALARM_ID id)
private

Triggers the alarm for the GameObject.

Parameters
idThe alarm ID to trigger.
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: