Skip to content

Interface IViewDrawable

Definition

Namespace: StardewUI.Framework
Assembly: StardewUI.dll

Provides methods to update and draw a simple, non-interactive UI component, such as a HUD widget.

public interface IViewDrawable : System.IDisposable

Implements
IDisposable

Members

Properties

Name Description
ActualSize The current size required for the content.
Context The context, or "model", for the menu's view, which holds any data-dependent values.
MaxSize The maximum size, in pixels, allowed for this content.

Methods

Name Description
Draw(SpriteBatch, Vector2) Draws the current contents.

Details

Properties

ActualSize

The current size required for the content.

Microsoft.Xna.Framework.Vector2 ActualSize { get; }
Property Value

Vector2

Remarks

Use for calculating the correct position for a Draw(SpriteBatch, Vector2), especially for elements that should be aligned to the center or right edge of the viewport.


Context

The context, or "model", for the menu's view, which holds any data-dependent values.

System.Object Context { get; set; }
Property Value

Object

Remarks

The type must implement INotifyPropertyChanged in order for any changes to this data to be automatically reflected on the next Draw(SpriteBatch, Vector2).


MaxSize

The maximum size, in pixels, allowed for this content.

Microsoft.Xna.Framework.Vector2? MaxSize { get; set; }
Property Value

Nullable<Vector2>

Remarks

If no value is specified, then the content is allowed to use the entire uiViewport.


Methods

Draw(SpriteBatch, Vector2)

Draws the current contents.

void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch b, Microsoft.Xna.Framework.Vector2 position);
Parameters

b   SpriteBatch
Target sprite batch.

position   Vector2
Position on the screen or viewport to use as the top-left corner.