IApplication

Description

interface Tinman.Engine.Application.IApplication

Base interface for interactive real-time applications that are run by an ApplicationLoop.

The following methods will never be called from more than one thread at a time.

The main loop will be run only if there is a valid graphics context.

Public / Methods

Graphics​Context​Attach


public method GraphicsContextAttach → (1)

context in : IGraphicsContext

[not-null]
The graphics context.

Attaches the application to its graphics context.

RenderException

If a graphics subsystem error has occurred.

Graphics​Context​Detach


public method GraphicsContextDetach → ()

Detaches the application from its graphics context.

Run​Operation


public method RunOperation → (1)

operation in : IOperation own

[not-null]
The operation to run.

returns → RunningOperation

The running operation.

Runs the given operation within the lifecycle of this application.

The RunningOperation.Update method is called from within the applications IUpdateableFrameTime.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 cancelled (see RunningOperation.Cancel) and then disposed.

Window​Attach


public method WindowAttach → (1)

window in : IApplicationWindow

[not-null]
The application window.

Attaches the application to its window.

This is always the first callback that the application receives.

Window​Resolution


public method WindowResolution → (1)

dpi in : int32

The resolution, in dots per inch (DPI).

Informs the application about the DPI resolution of its window.

The dpi in value may be used by an application to choose appropriate sizes for fonts, images and other visual resources. Here are some common DPI values:

  • 96 DPI - 100% scaling

  • 120 DPI - 125% scaling

  • 144 DPI - 150% scaling

  • 168 DPI - 175% scaling

  • 192 DPI - 200% scaling

If the enclosing process is treated as DPI-unaware, an IApplication will see 96 DPI in conjunction with logical screen coordinates and the system will scale the render output automatically.

Window​Size


public method WindowSize → (1)

clientSize in : Vec2I

The client size of the application window, in physical screen pixels.

Informs the application about the client size of its window.

Extensions

Run

2 overloads


[OwnerThis]
public static method Run1 → (4)

source in : string

[not-empty]
The error source to use in case an exception is thrown.

context in : IGraphicsContextFactory

[not-null]
The graphics context factory to use.

window in : IApplicationWindow own

[not-null]
The application window to use.

sleepOnIdle in : bool

Honour ApplicationLoopResult.Idle by sleeping for a short time?

returns → TinmanError

The error in case of a crash, null if the application has ended normally.

Runs this application.


[OwnerThis]
public static method Run2 → (5)

source in : string

[not-empty]
The error source to use in case an exception is thrown.

contexts in : IVectorConst<IGraphicsContextFactory>

[not-empty]
The graphics context factories to use.

window in : IApplicationWindow own

[not-null]
The application window to use.

sleepOnIdle in : bool

Honour ApplicationLoopResult.Idle by sleeping for a short time?

context opt : int32 = 0

[0..contexts.Count-1]
Index of initial graphics context factory in contexts in.

returns → TinmanError

The error in case of a crash, null if the application has ended normally.

Runs this application.