Midnight Blue Game and Engine
Public Member Functions | Properties | List of all members
MB2D.UI.UIView Class Reference

A single context for all UI elements and layouts. More...

Inheritance diagram for MB2D.UI.UIView:
Inheritance graph
Collaboration diagram for MB2D.UI.UIView:
Collaboration graph

Public Member Functions

 UIView (int rows, int cols)
 Initializes a new instance of the T:MB2D.UI.UIView class. Divides itself into the number of rows and columns evenly based on the size of the current viewport. More...
 
void Update ()
 Updates and handles input for all elements in the View. More...
 
void Draw (SpriteBatch spriteBatch, SpriteBatch uiSpriteBatch)
 Draws the View and its elements to the window More...
 
void Add (UIElement element, int atRow, int atCol, int rowSpan, int colSpan)
 Adds a new UIElement to the View More...
 
void AddToLookup (UIElement element)
 Adds an element to the lookup table used by the view More...
 

Properties

UIElement this[string key] [get]
 Gets the T:MB2D.UI.UIElement with the specified key. More...
 
UIElement [,] Content [get]
 Gets the elements this View contains in a 2D array More...
 
Texture2D BackgroundTexture [get, set]
 Gets or sets the background texture of the view. More...
 
bool StretchBackground [get, set]
 Gets or sets a value indicating whether the background image shoudl stretch to fit the window. More...
 

Detailed Description

A single context for all UI elements and layouts.

Constructor & Destructor Documentation

§ UIView()

MB2D.UI.UIView.UIView ( int  rows,
int  cols 
)
inline

Initializes a new instance of the T:MB2D.UI.UIView class. Divides itself into the number of rows and columns evenly based on the size of the current viewport.

Parameters
rowsNumber of rows in the view
colsNumber of columns in the view

Member Function Documentation

§ Add()

void MB2D.UI.UIView.Add ( UIElement  element,
int  atRow,
int  atCol,
int  rowSpan,
int  colSpan 
)
inline

Adds a new UIElement to the View

Parameters
elementElement to add.
atRowRow position in the View.
atColColumn position in the View.
rowSpanNumber of rows the element takes up.
colSpanNumber of columns the element takes up.
Here is the call graph for this function:
Here is the caller graph for this function:

§ AddToLookup()

void MB2D.UI.UIView.AddToLookup ( UIElement  element)
inline

Adds an element to the lookup table used by the view

Parameters
elementElement to add.
Here is the caller graph for this function:

§ Draw()

void MB2D.UI.UIView.Draw ( SpriteBatch  spriteBatch,
SpriteBatch  uiSpriteBatch 
)
inline

Draws the View and its elements to the window

Parameters
uiSpriteBatchSprite batch to draw to.
Here is the call graph for this function:
Here is the caller graph for this function:

§ Update()

void MB2D.UI.UIView.Update ( )
inline

Updates and handles input for all elements in the View.

Here is the call graph for this function:
Here is the caller graph for this function:

Property Documentation

§ BackgroundTexture

Texture2D MB2D.UI.UIView.BackgroundTexture
getset

Gets or sets the background texture of the view.

The background texture.

§ Content

UIElement [,] MB2D.UI.UIView.Content
get

Gets the elements this View contains in a 2D array

All UIElements.

§ StretchBackground

bool MB2D.UI.UIView.StretchBackground
getset

Gets or sets a value indicating whether the background image shoudl stretch to fit the window.

true if background should be stretched; otherwise, false.

§ this[string key]

UIElement MB2D.UI.UIView.this[string key]
get

Gets the T:MB2D.UI.UIElement with the specified key.

Parameters
keyTag of the element.

The documentation for this class was generated from the following file: