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
contentManagerIContentManagerrenderContextFactoryIRenderContextFactorytextRendererITextRenderer
Exceptions
- ArgumentNullException
textRendereris null.
Properties
Background
The texture behind the box. Set by LoadContent().
public ITexture Background { get; set; }
Property Value
Font
The font the message is drawn in. Set by LoadContent().
public IFont Font { get; set; }
Property Value
IconIndex
The icon shown. None shows none.
public Spinner.Icon IconIndex { get; set; }
Property Value
Icons
The atlas of icon pictures. Set by LoadContent().
public ITextureAtlas Icons { get; set; }
Property Value
Text
The message. The box shows it followed by three dots.
public string Text { get; set; }
Property Value
Methods
Attach(IGame)
Adds the spinner to game's components, so that it draws.
public void Attach(IGame game)
Parameters
gameIGame
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
Returns
Display(Icon, string)
Shows the spinner with icon and text until Hide() is called.
public void Display(Spinner.Icon icon, string text)
Parameters
Draw(IGameTime)
Draws the box, its icon and its message while the spinner is visible.
public override void Draw(IGameTime gameTime)
Parameters
gameTimeIGameTime
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()