C# Class Gonzo.Elements.UIButton

A clickable button that can trigger an event. A button is always graphically represented by four equally sized frames in a texture.
Inheritance: UIElement
Datei anzeigen Open project: Afr0Games/Project-Dollhouse Class Usage Examples

Public Properties

Property Type Description
Enabled bool
m_IsButtonClicked bool

Public Methods

Method Description
AddImage ( UIImage Img ) : void

Adds an image to this button, because (you guessed it) sometimes buttons will be defined without images...

Draw ( SpriteBatch SBatch, float LayerDepth ) : void
DrawBorder ( SpriteBatch SBatch, Rectangle rectangleToDraw, int thicknessOfBorder, Microsoft.Xna.Framework.Color borderColor ) : void

Draws a border around this button, for debugging purposes.

IsMouseOver ( InputHelper Input ) : bool
UIButton ( AddButtonNode Node, ParserState State, UIScreen Screen ) : Files
UIButton ( string Name, Microsoft.Xna.Framework.Graphics.Texture2D Tex, Vector2 Pos, UIScreen Screen, UIElement Parent = null ) : Files

Constructs a new UIButton instance.

Update ( InputHelper Input, GameTime GTime ) : void

Private Methods

Method Description
ScaleToText ( ) : void

Scales a button to the size of the button's text. Also repositions a button's text according to the new size.

Method Details

AddImage() public method

Adds an image to this button, because (you guessed it) sometimes buttons will be defined without images...
public AddImage ( UIImage Img ) : void
Img UIImage The image to add.
return void

Draw() public method

public Draw ( SpriteBatch SBatch, float LayerDepth ) : void
SBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
LayerDepth float
return void

DrawBorder() public method

Draws a border around this button, for debugging purposes.
public DrawBorder ( SpriteBatch SBatch, Rectangle rectangleToDraw, int thicknessOfBorder, Microsoft.Xna.Framework.Color borderColor ) : void
SBatch Microsoft.Xna.Framework.Graphics.SpriteBatch A Spritebatch to draw with.
rectangleToDraw Microsoft.Xna.Framework.Rectangle A rectangle that will make up the border.
thicknessOfBorder int Thickness of border to be drawn.
borderColor Microsoft.Xna.Framework.Color Color of border.
return void

IsMouseOver() public method

public IsMouseOver ( InputHelper Input ) : bool
Input InputHelper
return bool

UIButton() public method

public UIButton ( AddButtonNode Node, ParserState State, UIScreen Screen ) : Files
Node UIParser.Nodes.AddButtonNode
State UIParser.ParserState
Screen UIScreen
return Files

UIButton() public method

Constructs a new UIButton instance.
public UIButton ( string Name, Microsoft.Xna.Framework.Graphics.Texture2D Tex, Vector2 Pos, UIScreen Screen, UIElement Parent = null ) : Files
Name string Name of button.
Tex Microsoft.Xna.Framework.Graphics.Texture2D Texture used to display this button.
Pos Microsoft.Xna.Framework.Vector2
Screen UIScreen This button's screen.
Parent UIElement
return Files

Update() public method

public Update ( InputHelper Input, GameTime GTime ) : void
Input InputHelper
GTime Microsoft.Xna.Framework.GameTime
return void

Property Details

Enabled public_oe property

Is this button enabled (I.E not greyed out?)
public bool Enabled
return bool

m_IsButtonClicked public_oe property

public bool m_IsButtonClicked
return bool