TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class ApplicationLoop in Tinman.AddOns.Application

The ApplicationLoop class implements the main loop of an interactive real-time application.

sealed class ApplicationLoop extends Disposable
  implements IEventListenerGeneric<InputEvent>

Remarks

To run a real-time application, only three steps are necessary:

  1. Create an ApplicationLoop object.
  2. Repeatedly call MainLoop until it returns false.
  3. Dispose the ApplicationLoop loop object.
Proper callbacks to the IApplication object will be made automatically.

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.

Public / Attributes

ContextFactories

Specifies the graphics context factories to use.

public property ContextFactories { set }
type IVectorConst<IGraphicsContextFactory>
value [not-null] The list of graphics context factories.

Exceptions:

ContextFactory

Specifies the graphics context factory to use.

public property ContextFactory { set }
type IGraphicsContextFactory
value [not-null] The graphics context factory.

Exceptions:

FrameIndex

Returns the current frame index.

public property FrameIndex { get }
type int32
value [>=0] 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.

LifecycleState

Returns the lifecycle state of this object.

public virtual property LifecycleState { get }
type LifecycleState
value The lifecycle state.
inherited Disposable.LifecycleState

TimeIndex

Returns the current time index.

public property TimeIndex { get }
type float32
value [>=0] 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.

Public / Constructors

ApplicationLoop

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.

Public / Methods

AcquireTry

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.

Dispose

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.

MainLoop

Runs a single iteration of the application main loop.

public method MainLoop ()
type ApplicationLoopResult
returns The result code.

NotifyEvent

The event has been triggered.

public method NotifyEvent (InputEvent argument)
params argument The event argument.
implements IEventListenerGeneric.NotifyEvent

Run

Runs the application loop until the application terminates.

[OwnerThis]
public method Run ()

Remarks:

This ApplicationLoop object will have been disposed when this method returns.

Logging

Logger

The logger object of this class.

public static readonly field Logger
type ILogger