The ApplicationLoop class implements the main loop of an interactive real-time application.
sealed class
|
ApplicationLoop
|
extends
|
Disposable
|
||
implements
|
IEventListenerGeneric<InputEvent>
|
To run a real-time application, only three steps are necessary:
false
.The NotifyEvent method can be used to manually inject input events to the application loop. The events will be processed the next time MainLoop is called.
Specifies the graphics context factories to use.
public
property
|
ContextFactories
{
set
}
|
||
type
|
IVectorConst<IGraphicsContextFactory>
|
||
value
|
|
The list of graphics context factories. |
Exceptions:
Specifies the graphics context factory to use.
public
property
|
ContextFactory
{
set
}
|
||
type
|
IGraphicsContextFactory
|
||
value
|
|
The graphics context factory. |
Exceptions:
Returns the current frame index.
public
property
|
FrameIndex
{
get
}
|
||
type
|
int32
|
||
value
|
|
The frame index. |
Remarks:
The frame index counts the number of calls to Present that have been made from inside the MainLoop. Frames that do not require rendering are counted, too.
Returns the lifecycle state of this object.
public
virtual
property
|
LifecycleState
{
get
}
|
||
type
|
LifecycleState
|
||
value
|
The lifecycle state. | ||
inherited
|
Disposable.LifecycleState
|
Returns the current time index.
public
property
|
TimeIndex
{
get
}
|
||
type
|
float32
|
||
value
|
|
The running time, in seconds. |
Remarks:
The time index is the update time that has been accumulated in the MainLoop. This value correlates to the calls to UpdateFrameTime.
Creates a new instance of ApplicationLoop.
public
constructor
|
ApplicationLoop
([Owner]
IApplication application,
[Owner]
IApplicationWindow window,
IGraphicsContextFactory graphicsContextFactory)
|
||
params
|
application
|
[not-null]
|
The application to run. |
window
|
[not-null]
|
The application window to use. | |
graphicsContextFactory
|
[not-null]
|
The graphics context factory to use. |
Creates a new instance of ApplicationLoop.
public
constructor
|
ApplicationLoop
([Owner]
IApplication application,
[Owner]
IApplicationWindow window,
IVectorConst<IGraphicsContextFactory> graphicsContextFactories)
|
||
params
|
application
|
[not-null]
|
The application to run. |
window
|
[not-null]
|
The application window to use. | |
graphicsContextFactories
|
[not-empty]
|
The graphics context factories to use. |
Acquires a strong reference to this disposable object.
[OwnerReturn, ThreadSafe]
|
||||
public
method
|
AcquireTry
()
|
|||
type
|
IDisposable
|
|||
returns
|
this
if
a
new
strong
reference
has
been
acquired,
null
if
this
object
is
already
being
disposed.
|
|||
inherited
|
Disposable.AcquireTry
|
Remarks:
The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry method is responsible for calling the Dispose method accordingly.
This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.
Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.
[Dispose, OwnerThis, ThreadSafe]
|
||||
public
method
|
Dispose
()
|
|||
inherited
|
Disposable.Dispose
|
Remarks:
The Dispose method silently returns if the object has already been disposed.
Runs a single iteration of the application main loop.
public
method
|
MainLoop
()
|
||
type
|
ApplicationLoopResult
|
||
returns
|
The result code. |
The event has been triggered.
public
method
|
NotifyEvent
(InputEvent argument)
|
||
params
|
argument
|
The event argument. | |
implements
|
IEventListenerGeneric.NotifyEvent
|
Runs the application loop until the application terminates.
[OwnerThis]
|
||||
public
method
|
Run
()
|
Remarks:
This ApplicationLoop object will have been disposed when this method returns.
The logger object of this class.
public
static
readonly
field
|
Logger
|
||
type
|
ILogger
|