sealed class Tinman.Engine.Drawing.ScreenLabelPlacement

Derived from


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

Public / Constructors


public constructor ScreenLabelPlacement → ()

Creates a new instance of ScreenLabelPlacement.

Public / Methods


public method Add → (5)

label in : IScreenLabel

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.


public method Clear → ()

Removes all screen labels.


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.


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.


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 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


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.


public attribute Size → (get,set)

value : Vec2I

The screen size.

The screen size.