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

class DemoApplication in Tinman.Demo

The DemoApplication class is the entry point of the Tinman Demo application.

sealed class DemoApplication extends WidgetApplication

Configuration

ToConfig

Returns the configuration value that describes this object.

public override method ToConfig ()
type ConfigValue
returns [not-null] The configuration value.
inherited WidgetApplication.ToConfig

Remarks:

All configurable objects need to implement this interface. For simple types, it is preferable to delegate to ToValue.

The returned value may be of type Invalid, which means that this object in its current state cannot be described with the configuration API.

Before returning the resulting configuration value, Cache must be called on it, passing this IConfigurable object as parameter.

Public / Attributes

EnableCloseOnEscape

Request to close the application by calling Closing when Escape is pressed an no widgets has consumed the corresponding input event?

public property EnableCloseOnEscape { get set }
type bool
value true to close the application upon Escape, false to keep running.
inherited WidgetApplication.EnableCloseOnEscape

Remarks:

The default value is true.

EnableFullscreenOnF12

Toggle fullscreen mode (if possible) when the F12 key is pressed?

public property EnableFullscreenOnF12 { get set }
type bool
value true to enable fullscreen mode toggling, false to disable it.
inherited WidgetApplication.EnableFullscreenOnF12

Remarks:

The default value is true.

FrameRateLimit

Optional limit for rendering frames.

public override property FrameRateLimit { get }
type int32
value [>=0] The frame rate limit, in Hz. If 0 the limit will be disabled.
inherited WidgetApplication.FrameRateLimit

Remarks:

Defaults to 100.

LifecycleState

Returns the lifecycle state of this object.

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

Public / Constructors

DemoApplication

Creates a new instance of DemoApplication.

public constructor DemoApplication (DemoApplicationConfig config, [Owner] IWidget widget = null)
params config [not-null] The configuration settings to use.
  widget The demo widget to run or null to run the default one.

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.

ConsumeInput

Consumes the given user input event.

public override method ConsumeInput (InputEvent inputEvent)
type bool
params inputEvent The user input event.
returns true if the input event has been consumed, false if not.
inherited WidgetApplication.ConsumeInput

Remarks:

Input events are provided to an IInputConsumer object only if it has the input focus (see FocusGained and FocusLost). Mouse events are provided when the mouse cursor is inside of the input bounds (MouseEnter and MouseLeave). The Closing event can be provided at any time.

  1. FocusGained: gained input focus
  2. Keyboard events:
  3. Mouse events:
    1. MouseEnter
    2. Mouse events:
    3. MouseLeave
  4. FocusLost: lost input focus
  5. Closing: user request to shut down

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.

GraphicsContextAttach

Attaches the application to its graphics context.

public override method GraphicsContextAttach (IGraphicsContext context)
params context [not-null] The graphics context.
inherited WidgetApplication.GraphicsContextAttach

GraphicsContextDetach

Detaches the application from its graphics context.

public override method GraphicsContextDetach ()
inherited WidgetApplication.GraphicsContextDetach

IsDown

Is the given keyboard key pressed down?

[Pure]
public method IsDown (KeyboardKey key)
type bool
params key The keyboard key.
returns true if the key is pressed down, false if not.
inherited ApplicationBase.IsDown

Is the given mouse button pressed down?

[Pure]
public method IsDown (MouseButton button)
type bool
params button The mouse button.
returns true if the button is pressed down, false if not.
inherited ApplicationBase.IsDown

Render

Performs rendering.

public override method Render ()
inherited WidgetApplication.Render

Remarks:

Implementing methods must not assume that any specific render state is in place when being called. Instead, the implementing method is responsible for setting up all state that is required for rendering.

Usually, implementing classes receive their current graphics context directly or indirectly from GraphicsContextAttach or GraphicsAttach.

In order to maximize parallelism between the CPU and GPU, only actual rendering (using the current graphics context) should be performed here. All other preparation resp. setup should be done in RenderPrepare instead.

See also:

IApplication.GraphicsContextAttach
IGraphicsComponent.GraphicsAttach

RenderPrepare

Prepares rendering.

public override method RenderPrepare ()
inherited WidgetApplication.RenderPrepare

Remarks:

This method is called before Render, when the graphics context has not yet begun to render the scene.

All setup work that does not require a graphics context (e.g. matrix computation, per-frame visibility determination) should be done here. This can help to maximize parallelism between the CPU and the GPU.

Run

Runs the Tinman Demo application in stand-alone mode.

public static method Run ([Owner] IWidget widget = null)
type TinmanError
params widget The demo widget to run or null to run the default one.
returns The error that has caused the application to crash or null.

RunOperation

Runs the given operation within the lifecycle of this application.

public method RunOperation ([Owner] IOperation operation)
type RunningOperation
params operation [not-null] The operation to run.
returns [not-null] The running operation.
inherited ApplicationBase.RunOperation

Remarks:

The Update method is called from within the applications UpdateFrameTime method.

The returned RunningOperation can be used to track progress resp. errors and to cancel the running operation.

When the application is disposed, all running operations are canceled (see Cancel) and then disposed.

Statistics

Provides runtime performance statistics to the application.

public virtual method Statistics (ApplicationStats stats)
params stats The performance statistic values.
inherited ApplicationBase.Statistics

Remarks:

This information is gathered by the application loop which is running the application.

Calling this method is optional. Implementations of IApplication must never depend on the availability of ApplicationStats values.

UpdateFrameTime

This method is called once per application frame.

public override method UpdateFrameTime (float32 time)
type bool
params time [>0] The amount of time that has elapsed since the last frame, in seconds.
returns true if the object needs to be presented again, false if the current presentation is still valid.
inherited WidgetApplication.UpdateFrameTime

WidgetAdd

Adds the given widget.

public method WidgetAdd ([Owner] IWidget widget)
params widget [not-null] The widget to add.
inherited WidgetApplication.WidgetAdd

WidgetRemove

Removes the given widget.

public method WidgetRemove (IWidget widget)
params widget [not-null] The widget to remove.
inherited WidgetApplication.WidgetRemove

WidgetToBack

Puts the given widget into the background.

public method WidgetToBack (IWidget widget)
params widget [not-null] The widget.
inherited WidgetApplication.WidgetToBack

Remarks:

Widgets are rendered back-to-front. Input is consumed front-to-back until a widget has consumed the input event.

WidgetToFront

Puts the given widget into the foreground.

public method WidgetToFront (IWidget widget)
params widget [not-null] The widget.
inherited WidgetApplication.WidgetToFront

Remarks:

Widgets are rendered back-to-front. Input is consumed front-to-back until a widget has consumed the input event.

WindowAttach

Attaches the application to its window.

public virtual method WindowAttach (IApplicationWindow window)
params window [not-null] The application window.
inherited ApplicationBase.WindowAttach

Remarks:

This is always the first callback that the application receives.

WindowSize

Informs the application about the client size of its window.

public override method WindowSize (Vec2I clientSize)
params clientSize The client size of the application window.
inherited WidgetApplication.WindowSize

Logging

Logger

The logger object of this class.

public static readonly field Logger
type ILogger

LogMessage_Crash

The Demo Application has crashed because of an unexpected error.

public static readonly field LogMessage_Crash
type ILogMessage

Remarks:

Label parameters:

#0:
The exception details of the demo application crash.

See also:

LogSeverity.Common