Class GuiManager
Assembly: Ritchie.Toolbox.dll
public sealed class GuiManager : IFontFamilyProvider
Constructors
GuiManager(IGuiContext, IVisualStyle?)
Declaration
public GuiManager(IGuiContext context, IVisualStyle? globalStyle = null)
Parameters
Properties
Declaration
public static GuiManager? Current { get; }
Property Value
Declaration
public Vector2 GuiScale { get; }
Property Value
Declaration
public bool IsRendering { get; }
Property Value
Declaration
public int ReferenceHeight { get; set; }
Property Value
Declaration
public int ReferenceWidth { get; set; }
Property Value
Declaration
public GuiScaleMode ScaleMode { get; set; }
Property Value
Declaration
public int ScreenHeight { get; }
Property Value
Declaration
public int ScreenWidth { get; }
Property Value
Declaration
public IOrderedCollection<Widget> TopLevels { get; }
Property Value
Declaration
public float ViewportScaleRatio { get; set; }
Property Value
Methods
Find a widget under the specified position on the canvas.
Declaration
public Widget? FindWidget(Point position, bool includeDisabled = false, bool includeHidden = false)
Parameters
Type |
Name |
Description |
Point |
position |
The position, in canvas units, to find a widget under.
|
bool |
includeDisabled |
Whether or not disabled widgets should be counted.
|
bool |
includeHidden |
Whether or not visyally-hidden widgets should be counted.
|
Returns
Type |
Description |
Widget |
An instance of Widget representing the found widget, or null if none was found.
|
Find a widget of the specified type under the specified position on the canvas.
Declaration
public T? FindWidget<T>(Point position, bool includeDisabled = false, bool includeHidden = false)
Parameters
Type |
Name |
Description |
Point |
position |
The position, in canvas units, to find a widget under.
|
bool |
includeDisabled |
Whether or not disabled widgets should be counted.
|
bool |
includeHidden |
Whether or not visyally-hidden widgets should be counted.
|
Returns
Type |
Description |
T |
An instance of T representing the found widget, or null if none was found.
|
Type Parameters
Name |
Description |
T |
The type of widget to find, or an interface it should implement.
|
GetFont(PresetFontFamily)
Declaration
public IFontFamily GetFont(PresetFontFamily family)
Parameters
Returns
Declaration
[Obsolete("Please use the new StyleManager API instead.")]
public IVisualStyle GetVisualStyle()
Returns
Invalidates the geometry of all interface elements recursively. Use this when changing a global UI setting that affects how all widgets render.
Note: This is expensive. That should be obvious. So do not call it every frame.
Declaration
public void InvalidateAllGeometry()
Declaration
public bool IsFocused(Widget widget)
Parameters
Type |
Name |
Description |
Widget |
widget |
|
Returns
Declaration
Declaration
public void SendCharacter(Keys key, char character)
Parameters
Type |
Name |
Description |
Keys |
key |
|
char |
character |
|
Declaration
public void SendKey(Keys key, ButtonState state)
Parameters
Type |
Name |
Description |
Keys |
key |
|
ButtonState |
state |
|
Declaration
public void SendMouseButton(MouseButtonEventArgs e)
Parameters
Type |
Name |
Description |
MouseButtonEventArgs |
e |
|
Declaration
public void SetFocusedWidget(Widget? widgetToFocus)
Parameters
Type |
Name |
Description |
Widget |
widgetToFocus |
|
Declaration
public void SetMouseState(MouseState state)
Parameters
Type |
Name |
Description |
MouseState |
state |
|
Declaration
public void Update(float deltaTime)
Parameters
Type |
Name |
Description |
float |
deltaTime |
|
Declaration
public void UpdateLayout()
Events
Declaration
public event Action<MouseButtonEvent>? MouseClicked
Event Type
Declaration
public event Action<MouseButtonEvent>? MouseDown
Event Type
Declaration
public event Action<MouseButtonEvent>? MouseUp
Event Type
Implements