3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
Loading...
Searching...
No Matches
Engine3DRadSpace.Objects::Timer Class Reference

Represents an event object that executes an event at a specified interval, for a specified number of times. More...

#include <Timer.hpp>

Inheritance diagram for Engine3DRadSpace.Objects::Timer:
Collaboration diagram for Engine3DRadSpace.Objects::Timer:

Public Member Functions

 Timer (const std::string &name="Timer", bool enabled=true, double interval=1.0, unsigned repeatCount=0, const Reflection::Event &event={})
 Constructs an timer object.
 Timer (Timer &&) noexcept=default
Timer & operator= (Timer &&) noexcept=default
void Initialize () override
 Calls ResetTimer().
void Load () override
 Does nothing.
void Load (const std::filesystem::path &path) override
 Does nothing.
void Update () override
 Count mechanism.
double GetRemainingTime () const noexcept
 Returns remaining time.
unsigned GetRemainingTicks () const noexcept
 Returns remaining ticks.
void ResetTimer () noexcept
 Resets the timer's elapsed time and tick count.
Reflection::UUID GetUUID () const noexcept override
 Gets the UUID of the Timer type.
Objects::Gizmos::IGizmo * GetGizmo () const noexcept override
 Returns null.
 ~Timer () override=default
Public Member Functions inherited from Engine3DRadSpace.Objects.IObject
void Enable ()
void Disable ()
bool Switch ()
void Show ()
void Hide ()
bool SwitchVisibility ()
IObject GetChild (int idx)
int GetChildrenCount ()
void InternalInitialize (IGame *game)
 Called by ObjectsList to set the _game Game instance. If there are objects manually managed, this MUST be called before Initialize or EditorInitialize.
Graphics::IGraphicsDevice * GetGraphicsDeviceHandle () const noexcept
 Returns the graphics device handle associated with this object.
IGame * GetGame () const noexcept
 Gets the game that this object belongs to.
IObject * operator[] (size_t idxChild) const
 Returns the idx-th child of this object.
IObject * GetParent () const noexcept
 Returns the parent of this object.
void SetParent (IObject *newParent) noexcept
 Sets the parent of this object.
bool HasParent () const noexcept
 Checks if this object has a parent.
size_t GetChildrenCount () const noexcept
 Returns the number of children of this object.
virtual void Enable ()
 Enables this object.
virtual void Disable ()
 Disables this object.
virtual bool Switch ()
 Switched the enable/disable state of this object.
virtual void Show ()
 Shows this object.
virtual void Hide ()
 Hides this object.
virtual bool SwitchVisibility ()
 Switches the visibility state of this object.
void Uninitialize () override
 Called before the object has the destructor called.
virtual ~IObject ()
Public Member Functions inherited from Engine3DRadSpace.IInitializable
void Initialize ()
virtual ~IInitializable ()=default
Public Member Functions inherited from Engine3DRadSpace.IUpdateable
void Update ()
virtual ~IUpdateable ()=default
Public Member Functions inherited from Engine3DRadSpace.ILoadable
void Load ()
void Load (string path)
virtual ~ILoadable ()=default

Public Attributes

double Interval = 1.0
 Timer interval expressed in seconds.
unsigned RepeatCount = 0
 How many times the timer executes.
Reflection::Event Event
 Executes each time the timer reaches the interval. Return value is ignored.
Public Attributes inherited from Engine3DRadSpace.Objects.IObject
std::string Name
 Name of the object.
ChildObjectCollection Children
 Children of this object.

Protected Attributes

double _elapsedTime = 0.0f
unsigned _ticks = 0
Protected Attributes inherited from Engine3DRadSpace.Objects.IObject
IGame * _game = nullptr
Graphics::IGraphicsDevice * _device = nullptr
IObject * _parent = nullptr

Additional Inherited Members

Protected Member Functions inherited from Engine3DRadSpace.Objects.IObject
 IObject (const std::string &name="Empty", bool enabled=false, bool visible=false)
 Default constructor used for reflection. Objects created with this constructor are initially invalid, until internalInitialize() is called.
 IObject (const IObject &) noexcept=delete
IObject & operator= (const IObject &) noexcept=delete
 IObject (IObject &&) noexcept=default
IObject & operator= (IObject &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.IInitializable
 IInitializable ()=default
 IInitializable (const IInitializable &) noexcept=default
IInitializable & operator= (const IInitializable &) noexcept=default
 IInitializable (IInitializable &&) noexcept=default
IInitializable & operator= (IInitializable &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.IUpdateable
 IUpdateable ()=default
 IUpdateable (const IUpdateable &) noexcept=default
IUpdateable & operator= (const IUpdateable &) noexcept=default
 IUpdateable (IUpdateable &&) noexcept=default
IUpdateable & operator= (IUpdateable &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.ILoadable
 ILoadable ()=default
 ILoadable (const ILoadable &) noexcept=default
ILoadable & operator= (const ILoadable &) noexcept=default
 ILoadable (ILoadable &&) noexcept=default
ILoadable & operator= (ILoadable &&) noexcept=default
Properties inherited from Engine3DRadSpace.Objects.IObject
string Name [get, set]
bool Enabled [get, set]
 Is this object enabled?
bool Visible [get, set]
 Is this object visible?
Reflection.UUID UUID [get]
IGame Game [get]
IGraphicsDevice GraphicsDevice [get]
IGizmo Gizmo [get]
ObjectCollection Children [get]
IObject Parent [get, set]
Properties inherited from Engine3DRadSpace.IPtrWrapper
IntPtr Handle [get]

Detailed Description

Represents an event object that executes an event at a specified interval, for a specified number of times.

Constructor & Destructor Documentation

◆ Timer() [1/2]

Timer::Timer ( const std::string & name = "Timer",
bool enabled = true,
double interval = 1.0,
unsigned repeatCount = 0,
const Reflection::Event & event = {} )

Constructs an timer object.

Parameters
nameObject name
enabledIs the timer running?
intervalTimer interval expressed in seconds
repeatCountHow many times the timer executes. 0 = infinite counts.
eventEvent to execute when the timer reaches the interval

◆ Timer() [2/2]

Engine3DRadSpace.Objects::Timer::Timer ( Timer && )
defaultnoexcept

◆ ~Timer()

Engine3DRadSpace.Objects::Timer::~Timer ( )
overridedefault

Member Function Documentation

◆ GetGizmo()

Gizmos::IGizmo * Timer::GetGizmo ( ) const
overridevirtualnoexcept

Returns null.

Returns
Null gizmo pointer

Implements Engine3DRadSpace.Objects.IObject.

◆ GetRemainingTicks()

unsigned Timer::GetRemainingTicks ( ) const
noexcept

Returns remaining ticks.

Returns
RepeatCoun

◆ GetRemainingTime()

double Timer::GetRemainingTime ( ) const
noexcept

Returns remaining time.

Returns
Interval - _elapsedTime

◆ GetUUID()

Reflection::UUID Timer::GetUUID ( ) const
overridevirtualnoexcept

Gets the UUID of the Timer type.

Returns
{2A1521AE-A905-48A0-8671-D2AC6B09B30D}

Implements Engine3DRadSpace.Objects.IObject.

◆ Initialize()

void Timer::Initialize ( )
overridevirtual

Calls ResetTimer().

Implements Engine3DRadSpace.IInitializable.

◆ Load() [1/2]

void Timer::Load ( )
overridevirtual

Does nothing.

Implements Engine3DRadSpace.ILoadable.

◆ Load() [2/2]

void Timer::Load ( const std::filesystem::path & path)
overridevirtual

Does nothing.

Parameters
pathIgnored.

Implements Engine3DRadSpace.ILoadable.

◆ operator=()

Timer & Engine3DRadSpace.Objects::Timer::operator= ( Timer && )
defaultnoexcept

◆ ResetTimer()

void Timer::ResetTimer ( )
noexcept

Resets the timer's elapsed time and tick count.

◆ Update()

void Timer::Update ( )
overridevirtual

Count mechanism.

Implements Engine3DRadSpace.IUpdateable.

Member Data Documentation

◆ _elapsedTime

double Engine3DRadSpace.Objects::Timer::_elapsedTime = 0.0f
protected

◆ _ticks

unsigned Engine3DRadSpace.Objects::Timer::_ticks = 0
protected

◆ Event

Reflection::Event Engine3DRadSpace.Objects::Timer::Event

Executes each time the timer reaches the interval. Return value is ignored.

◆ Interval

double Engine3DRadSpace.Objects::Timer::Interval = 1.0

Timer interval expressed in seconds.

◆ RepeatCount

unsigned Engine3DRadSpace.Objects::Timer::RepeatCount = 0

How many times the timer executes.

0 = infinite counts.


The documentation for this class was generated from the following files:
  • E:/3DRadSpace/Engine3DRadSpace/Objects/Impl/Timer.hpp
  • E:/3DRadSpace/Engine3DRadSpace/Objects/Impl/Timer.cpp