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

Screen​Label​Placement


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.

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.

Visible


[Pure]
public method Visible → (1)

ordinal in : int32

The screen label ordinal, as returned by Add.

returns → int32

-1 : if the screen label has not been drawn,
0 : if the screen label has been drawn as occluded,
+1 : if the screen label has been drawn as not occluded.

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

A screen label will not be drawn if it lies outside the screen bounds or if it is occluded and IScreenLabel.IsHiddenWhenOccluded returns true.

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.