ScreenLabelPlacement

Description

sealed class Tinman.Engine.Drawing.ScreenLabelPlacement

Derived from

IGraphicsComponent

Helper object for placing rectangular labels on a screen viewport while avoiding overlaps.

Public / Constructors

ScreenLabelPlacement


public constructor ScreenLabelPlacement → ()

Creates a new instance of ScreenLabelPlacement.

Public / Methods

Add


public method Add → (5)

label in : IScreenLabel

[not-null]
The screen label object.

bounds in : Box2I

The screen bounds.

offset opt : Vec2F = default(Vec2F)

Optional sub-pixel offset.

depth opt : float32 = 0

The screen depth (see Graphics.PushDepth).

priority opt : int32 = 0

Optional priority. Labels with lower priority will be hidden if necessary to avoid overlaps.

returns → int32

The ordinal that can be used to identify the added screen label later.

Adds a screen label.

Clear


public method Clear → ()

Removes all screen labels.

Get


[Pure]
public method Get → (1)

ordinal in : int32

The screen label ordinal, as returned by Add.

returns → ScreenLabelPlacementEntry

The placement information of the screen label or ScreenLabelPlacementEntry.None if ordinal in is invalid.

Returns the placement information of a screen label.

Occluded


public method Occluded → (1)

ordinal in : int32

The screen label ordinal, as returned by Add.

returns → bool

true if the screen label was occluded,
false if not.

Checks if a screen label has been drawn as occluded during the last call to Render.

Occupied


public method Occupied → (1)

bounds in : Box2I

The screen rectangle to add.

returns → bool

true if bounds in intersects with the occupied region, false if it does not.

Manually adds the given rectangle to the occupied screen region if it does not intersect with it.

Render


public method Render → ()

Renders the screen labels while avoiding overlaps.

Each call to IScreenLabel.RenderScreenLabel is wrapped in calls to the Graphics.PushDepth and Graphics.PopDepth methods.

Public / Attributes

Debug


public attribute Debug → (get,set)

value : bool

true to enable visual debug helpers, false to disable.

Enable visual debug helpers?

When set to true, the bounds of screen labels are shown as pink bars. Occluded screen labels are shown as pink rectangles.

Size


public attribute Size → (get,set)

value : Vec2I

The screen size.

The screen size.