Class GuiService
A major part of Socially Distant's core infrastructure, that manages everything to do with the user interface.
Inheritance
GameComponent
DrawableGameComponent
GuiService
Implements
IGameComponent
IUpdateable
IDrawable
Inherited Members
DrawableGameComponent.GraphicsDevice
DrawableGameComponent.DrawOrder
DrawableGameComponent.Visible
DrawableGameComponent.DrawOrderChanged
DrawableGameComponent.VisibleChanged
GameComponent.Dispose()
GameComponent.Enabled
GameComponent.UpdateOrder
GameComponent.EnabledChanged
GameComponent.UpdateOrderChanged
Assembly: SociallyDistant.Framework.dll
Syntax
public sealed class GuiService : DrawableGameComponent, IGameComponent, IUpdateable, IDisposable, IDrawable, IGuiContext
Constructors
GuiService(IGameContext, IInspector, IWidgetTreeRenderer)
Declaration
public GuiService(IGameContext sociallyDistantContext, IInspector debugInspector, IWidgetTreeRenderer widgetTreeRenderer)
Parameters
Properties
CanvasHeight
Gets the height of the GUI canvas in GUI units.
Declaration
public int CanvasHeight { get; }
Property Value
CanvasWidth
Gets the width of the GUI canvas in GUI units.
Declaration
public int CanvasWidth { get; }
Property Value
Game
Declaration
public Game Game { get; }
Property Value
GuiRoot
Gets a reference to the underlying GuiManager of Ritchie's Toolbox.
Declaration
public GuiManager GuiRoot { get; }
Property Value
PhysicalHeight
Gets a value indicating the physical height, in pixels, of the game window.
Declaration
public int PhysicalHeight { get; }
Property Value
PhysicalWidth
Gets a value representing the physical width, in pixels, of the game window.
Declaration
public int PhysicalWidth { get; }
Property Value
Methods
Draw(GameTime)
Declaration
public override void Draw(GameTime gameTime)
Parameters
Type |
Name |
Description |
GameTime |
gameTime |
|
Overrides
Microsoft.Xna.Framework.DrawableGameComponent.Draw(Microsoft.Xna.Framework.GameTime)
Declaration
public void DrawElements(GuiSubMesh subMesh, int offset, int primtiveCount)
Parameters
~GuiService()
Declaration
GetFallbackFont()
Declaration
public IFontFamily GetFallbackFont()
Returns
Grab(RenderTarget2D, Rectangle, Rectangle)
Renders the user interface to the given RenderTarget2D. Useful for certain widget rendering techniques such as background blurs.
Declaration
public void Grab(RenderTarget2D destination, Rectangle sourceArea, Rectangle destinationArea)
Parameters
Type |
Name |
Description |
RenderTarget2D |
destination |
|
Rectangle |
sourceArea |
|
Rectangle |
destinationArea |
|
Initialize()
Declaration
public override void Initialize()
Overrides
Microsoft.Xna.Framework.DrawableGameComponent.Initialize()
Declaration
public void PrepareWidgetRender(VertexBuffer vertices, LayoutRect? clipRect = null, IEffect? effectOverride = null, float opacity = 1, Point positionOffset = default)
Parameters
Type |
Name |
Description |
VertexBuffer |
vertices |
|
LayoutRect? |
clipRect |
|
IEffect |
effectOverride |
|
float |
opacity |
|
Point |
positionOffset |
|
RefreshAllGeometry()
Forcibly invalidate all geometry caches and re-render the UI. This method will not
immediately re-render the UI, but will post an event to the EventBus instructing
the game to invalidate caches before rendering the next frame.
Declaration
public static void RefreshAllGeometry()
Render(VertexPositionColorTexture[], int[], Texture2D?, LayoutRect?)
Declaration
public void Render(VertexPositionColorTexture[] vertices, int[] indices, Texture2D? texture, LayoutRect? clipRect = null)
Parameters
Type |
Name |
Description |
VertexPositionColorTexture[] |
vertices |
|
int[] |
indices |
|
Texture2D |
texture |
|
LayoutRect? |
clipRect |
|
RestoreRenderState()
Declaration
public void RestoreRenderState()
Update(GameTime)
Declaration
public override void Update(GameTime gameTime)
Parameters
Type |
Name |
Description |
GameTime |
gameTime |
|
Overrides
Microsoft.Xna.Framework.GameComponent.Update(Microsoft.Xna.Framework.GameTime)
Implements
Microsoft.Xna.Framework.IGameComponent
Microsoft.Xna.Framework.IUpdateable
Microsoft.Xna.Framework.IDrawable
Extension Methods