Widget

Description

abstract class Tinman.Engine.Widgets.Widget

Derived from

Disposable abstract
IWidget

Extended by

CanvasWidget sealed
DefaultControlsWidget abstract
MapViewWidget sealed
ModelWidget sealed
TestWidget sealed
TextureWidget sealed
Tutorial abstract
TutorialBrowser sealed

Base class for IWidget implementations.

Subclasses that wish to process screenshot requests via IWidget.Screenshot must call ScreenshotProcess from their IRenderable2D.Render2D.

Public / Constants

Settings​Default


public constant SettingsDefault → ("Settings.json":string)

Name of the default settings file (with file name extensions).

Protected / Constructors

Widget


protected constructor Widget → ()

Creates a new instance of Widget.

Protected / Methods

Dirty


protected method Dirty → ()

Marks the widget as dirty.

When a widget is dirty, the next call to IUpdateableFrameTime.UpdateFrameTime will always return true and the dirty flag will be cleared.

Do​Consume​Input


[EmptyBody]
protected virtual method DoConsumeInput → (1)

inputEvent in : InputEvent

The user input event.

returns → bool

true if the input event has been consumed, false if not.

Consumes the given user input event.

The given inputEvent in has already been translated to the current widget bounds (see IWidget.ActualBounds) and clipped to the non-UI screen region (see INonUserInterfaceBounds.NonUserInterfaceBounds).

Do​Update​Gui


[EmptyBody]
protected virtual method DoUpdateGui → (1)

valuesOnly in : bool

true to update values in the existing GUI structure,
false to rebuild the GUI structure before updating values.

Performs the work of IUpdateableGui.UpdateGui.

During the invocation of this method, IsUpdatingGui will return true.

Screenshot​Effect


protected virtual method ScreenshotEffect → (1)

time in : float32

The animation time, in seconds.

returns → bool

true if the visual effect has finished,
false if the visual effect is ongoing.

Renders the visual effect after taking a screenshot.

This method is called by ScreenshotProcess.

The default implementation renders a simple white flashlight effect.

Screenshot​Process


protected method ScreenshotProcess → ()

Processes the pending screenshot request and renders the post-screenshot visual effect.

This method must be called by subclasses from their IRenderable2D.Render2D method, if they wish to process screenshot requests. The built-in screenshot command via KeyboardKey.Pause will only be active if this method has been called at least once.

Settings

3 overloads


protected method Settings1 → ()

returns → Path

The canonical settings path.

Returns the path to the settings directory of this widget, creating parent directories if necessary.

IOException

If a parent directory failed to be created (IFileSystem.DirectoryCreate).


protected method Settings2 → (1)

path in : string

[not-empty]
Relative path into settings directory.

returns → Path

The canonical settings path.

Returns a path into the settings directory of this widget, creating parent directories if necessary.

IOException

If a parent directory failed to be created (IFileSystem.DirectoryCreate).


protected method Settings3 → (1)

path in : Path

[not-null]
Relative path into settings directory.

returns → Path

The canonical settings path.

Returns a path into the settings directory of this widget, creating parent directories if necessary.

IOException

If no settings path has been specified via IWidget.SettingsPath or if a parent directory failed to be created (IFileSystem.DirectoryCreate).

Size​Changed


[EmptyBody]
protected virtual method SizeChanged → (1)

size in : Vec2I

The new pixel size.

The pixel size of this widget has changed.

This method is called in these cases:

Protected / Attributes

components


protected attribute components → (ObjectList)

General purpose list of child components.

Subclasses are responsible for initializing this object list.

context


protected attribute context → (IGraphicsContext)

The current IGraphicsContext object or null.

graphics


protected attribute graphics → (Graphics)

The current Graphics object or null.

Use this Graphics object only during rendering (see IGraphicsContext.Graphics for details), i.e. from within one of the following methods:

Use screenSize to query the current screen size.

input


protected attribute input → (IInputState)

The input state object or null.

input​Modifiers


protected attribute inputModifiers → (InputModifiers)

The current input modifiers.

These flags are maintained when IInputConsumer.ConsumeInput is called.

Is​Updating​Gui


protected attribute IsUpdatingGui → (get)

value : bool

true if IUpdateableGui.UpdateGui is being called, false if not.

Is IUpdateableGui.UpdateGui being called?

mouse


protected attribute mouse → (Vec2I)

Current position of mouse cursor.

profiler


protected attribute profiler → (IProfiler)

The provided IProfiler object or null if none.

resolution


protected attribute resolution → (int32)

The current screen resolution.

runner


protected attribute runner → (IApplicationRunner)

The provided IApplicationRunner object or null.

screen​Size


protected attribute screenSize → (Vec2I)

The current screen size.

widget​Gui


protected attribute widgetGui → (IWidgetGui)

The provided IWidgetGui object or null if none.

Configuration

Config


public static attribute Config → (get)

value : IConfigurator<IWidget>

[not-null]
The configurator object.

The configurator object for this type.

Logging

Logger


public static readonly attribute Logger → (ILogger)

The logger object of this class.