Class MonoGameBuildingExtensions
- Namespace
- Icy.MonoGame.Configuration
- Assembly
- IcyUI.MonoGame.dll
Provides extension methods for configuring the IcyUI in MonoGame applications.
public static class MonoGameBuildingExtensions
- Inheritance
-
MonoGameBuildingExtensions
- Inherited Members
Remarks
IcyUI.MonoGame doesn't depend on a MonoGame backend. The host references one of:
MonoGame.Framework.DesktopGL(OpenGL/SDL), 3.8.5.1 or later;MonoGame.Framework.WindowsDX(Direct3D 11), 3.8.5.1 or later.
On DesktopGL, touch input isn't reported, and on Windows-on-ARM64 Microsoft.Xna.Framework.Game.Dispose() can hang on shutdown.
Methods
GetIcyCanvas(Game)
Gets the main canvas of the game.
public static Canvas GetIcyCanvas(this Game game)
Parameters
gameGameThe game.
Returns
- Canvas
The host's MainCanvas.
Exceptions
- InvalidOperationException
IcyUI isn't set up yet: call UseIcyUI(Game) first.
GetIcyConfiguration(Game)
Gets the configuration IcyUI runs with in the game.
public static IcyConfiguration GetIcyConfiguration(this Game game)
Parameters
gameGameThe game.
Returns
- IcyConfiguration
The host's Configuration.
Exceptions
- InvalidOperationException
IcyUI isn't set up yet: call UseIcyUI(Game) first.
GetIcyHost(Game)
Gets the IcyUI host of the game.
public static MonoGameIcyHost GetIcyHost(this Game game)
Parameters
gameGameThe game.
Returns
- MonoGameIcyHost
The host UseIcyUI(Game) created.
Exceptions
- InvalidOperationException
IcyUI isn't set up yet: call UseIcyUI(Game) first.
TryGetIcyHost(Game, out MonoGameIcyHost?)
Gets the IcyUI host of the game, if UseIcyUI(Game) ran.
public static bool TryGetIcyHost(this Game game, out MonoGameIcyHost? host)
Parameters
gameGameThe game.
hostMonoGameIcyHostThe host, or null.
Returns
UseIcyUI(Game)
Sets IcyUI up in the game with the default MonoGame configuration: the default theme, markup support,
system fonts with "Segoe UI", and log messages in the debugger's output window.
public static MonoGameIcyHost UseIcyUI(this Game game)
Parameters
gameGameThe game; call this in
Initialize(), beforebase.Initialize().
Returns
- MonoGameIcyHost
The host, whose MainCanvas is ready for elements.
Exceptions
- InvalidOperationException
IcyUI is already set up for this game.
UseIcyUI(Game, Action<IConfigurationBuilder>)
Sets IcyUI up in the game: the default MonoGame configuration first, then configure.
public static MonoGameIcyHost UseIcyUI(this Game game, Action<IConfigurationBuilder> configure)
Parameters
gameGameThe game; call this in
Initialize(), beforebase.Initialize().configureAction<IConfigurationBuilder>Changes the defaults, for example
ui => ui.ConfigureFonts().WithDefaultFontFamily("Arial").
Returns
- MonoGameIcyHost
The host, whose MainCanvas is ready for elements.
Exceptions
- InvalidOperationException
IcyUI is already set up for this game.
UseMonoGameImporters(IAssetConfigurationBuilder, Game)
Adds MonoGame-specific importers to the asset configuration builder.
public static IAssetConfigurationBuilder UseMonoGameImporters(this IAssetConfigurationBuilder builder, Game game)
Parameters
builderIAssetConfigurationBuilderThe asset configuration builder instance to configure.
gameGameThe Microsoft.Xna.Framework.Game instance used for configuration.
Returns
- IAssetConfigurationBuilder
The updated asset configuration builder instance for fluent configuration.
WithDefaultMonoGameConfiguration(IConfigurationBuilder, Game)
Configures the default settings for MonoGame in the provided configuration builder.
public static IConfigurationBuilder WithDefaultMonoGameConfiguration(this IConfigurationBuilder builder, Game game)
Parameters
builderIConfigurationBuilderThe configuration builder instance to configure.
gameGameThe Microsoft.Xna.Framework.Game instance used for configuration.
Returns
- IConfigurationBuilder
The updated configuration builder instance for fluent configuration.
Remarks
Besides the MonoGame rendering, input and asset importers, the defaults are:
- markup support (AddMarkupSupport(IConfigurationBuilder));
- the built-in theme (UseDefaultTheme(IConfigurationBuilder));
- system fonts, with
"Segoe UI"as the default family; - log messages in the debugger's output window (DebuggerLoggerProvider).