Table of Contents

Class Spinner

Namespace
BSGameLib.UI.Components
Assembly
BSGameLib.UI.dll

A box with an icon and a message, drawn over the view while something runs. It is a game component: Attach(IGame) adds it to the game so that it draws.

public class Spinner : DrawableComponent, IUpdateable, IEquatable<IUpdateable>, IDrawable, IIdentifiable<Guid>, IEquatable<IDrawable>, IAttachOnGameStart
Inheritance
Spinner
Implements
Inherited Members

Constructors

Spinner(IContentManager, IRenderContextFactory, ITextRenderer)

Creates a spinner that starts hidden.

public Spinner(IContentManager contentManager, IRenderContextFactory renderContextFactory, ITextRenderer textRenderer)

Parameters

contentManager IContentManager
renderContextFactory IRenderContextFactory
textRenderer ITextRenderer

Exceptions

ArgumentNullException

textRenderer is null.

Properties

Background

The texture behind the box. Set by LoadContent().

public ITexture Background { get; set; }

Property Value

ITexture

Font

The font the message is drawn in. Set by LoadContent().

public IFont Font { get; set; }

Property Value

IFont

IconIndex

The icon shown. None shows none.

public Spinner.Icon IconIndex { get; set; }

Property Value

Spinner.Icon

Icons

The atlas of icon pictures. Set by LoadContent().

public ITextureAtlas Icons { get; set; }

Property Value

ITextureAtlas

Text

The message. The box shows it followed by three dots.

public string Text { get; set; }

Property Value

string

Methods

Attach(IGame)

Adds the spinner to game's components, so that it draws.

public void Attach(IGame game)

Parameters

game IGame

Begin(Icon, string)

Shows the spinner with icon and text, and returns an object that hides it when disposed. Use it in a using block.

public DisposableSpinner Begin(Spinner.Icon icon, string text)

Parameters

icon Spinner.Icon
text string

Returns

DisposableSpinner

Display(Icon, string)

Shows the spinner with icon and text until Hide() is called.

public void Display(Spinner.Icon icon, string text)

Parameters

icon Spinner.Icon
text string

Draw(IGameTime)

Draws the box, its icon and its message while the spinner is visible.

public override void Draw(IGameTime gameTime)

Parameters

gameTime IGameTime

Exceptions

InvalidOperationException

The spinner has no render context factory.

Hide()

Hides the spinner.

public void Hide()

LoadContent()

Loads the background, font and icon atlas from the content manager.

public override void LoadContent()