Helper object for placing rectangular labels on a screen viewport while avoiding overlaps.
sealed class
|
ScreenLabelPlacement
|
implements
|
IGraphicsComponent
|
Shade color to use for drawing occupied screen regions (useful for debugging).
public
property
|
ColorOccupied
{
get
set
}
|
||
type
|
int64
|
||
value
|
The shade color. |
Remarks:
Set
to
a
transparent
color
to
disable
drawing
of
occupied
regions.
Defaults
to
0
.
The screen size.
public
property
|
Size
{
get
set
}
|
||
type
|
Vec2I
|
||
value
|
The screen size. |
Creates a new instance of ScreenLabelPlacement.
public
constructor
|
ScreenLabelPlacement
()
|
Adds a screen label.
public
method
|
Add
(IScreenLabel label,
Box2I bounds,
float32 depth = 0,
int32 priority = 0)
|
||
params
|
label
|
[not-null]
|
The screen label object. |
bounds
|
The screen bounds. | ||
depth
|
The screen depth (see PushDepth). | ||
priority
|
Optional
priority.
Labels
with
lower
priority
will
be
hidden
if
necessary
to
avoid
overlaps.
Defaults
to
0 .
|
Removes all screen labels.
public
method
|
Clear
()
|
Attaches this component to the given Graphics context.
public
method
|
GraphicsAttach
(Graphics graphics)
|
||
params
|
graphics
|
[not-null]
|
The graphics context. |
implements
|
IGraphicsComponent.GraphicsAttach
|
Remarks:
All graphics-related resources should be created here.
Detaches this user interface component from its Graphics context.
public
method
|
GraphicsDetach
()
|
||
implements
|
IGraphicsComponent.GraphicsDetach
|
Remarks:
All graphics-related resources should be disposed here.
The screen size has changed.
public
method
|
GraphicsResize
(Vec2I screenSize)
|
||
params
|
screenSize
|
The new screen size, in pixels. | |
implements
|
IGraphicsComponent.GraphicsResize
|
Remarks:
The given screen size is equal to the value of ScreenSize of the Graphics object that has been passed to GraphicsAttach earlier.
Manually adds the given rectangle to the occupied screen region if it does not intersect with it.
public
method
|
Occupied
(Box2I bounds)
|
||
type
|
bool
|
||
params
|
bounds
|
The screen rectangle to add. | |
returns
|
true
if
bounds
intersects
with
the
occupied
region,
false
if
it
does
not.
|
Removes a screen label.
public
method
|
Remove
(IScreenLabel label)
|
||
params
|
label
|
[not-null]
|
The screen label. |
Renders the screen labels while avoiding overlaps.
public
method
|
Render
()
|
Remarks:
Each call to RenderScreenLabel is wrapped in calls to the PushDepth and PopDepth methods.