Table of Contents

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

game Game

The 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

game Game

The 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

game Game

The 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

game Game

The game.

host MonoGameIcyHost

The host, or null.

Returns

bool

true when IcyUI is set up.

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

game Game

The game; call this in Initialize(), before base.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

game Game

The game; call this in Initialize(), before base.Initialize().

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

builder IAssetConfigurationBuilder

The asset configuration builder instance to configure.

game Game

The 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

builder IConfigurationBuilder

The configuration builder instance to configure.

game Game

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