C# Class TraceRacer.Button

Represents a touchable button.
Show file Open project: alexcoco/trace_racer Class Usage Examples

Public Properties

Property Type Description
Alpha float
BorderColor Color
BorderThickness int
FillColor Color
Position Vector2
Size Vector2
Text string
TextColor Color

Public Methods

Method Description
Button ( string text ) : System

Creates a new Button.

Draw ( GameScreen screen ) : void

Draws the button

HandleTap ( Vector2 tap ) : bool

Passes a tap location to the button for handling.

Protected Methods

Method Description
OnTapped ( ) : void

Invokes the Tapped event and allows subclasses to perform actions when tapped.

Method Details

Button() public method

Creates a new Button.
public Button ( string text ) : System
text string The text to display in the button.
return System

Draw() public method

Draws the button
public Draw ( GameScreen screen ) : void
screen GameScreen The screen drawing the button
return void

HandleTap() public method

Passes a tap location to the button for handling.
public HandleTap ( Vector2 tap ) : bool
tap Vector2 The location of the tap.
return bool

OnTapped() protected method

Invokes the Tapped event and allows subclasses to perform actions when tapped.
protected OnTapped ( ) : void
return void

Property Details

Alpha public property

The opacity of the button.
public float Alpha
return float

BorderColor public property

The color of the button border.
public Color BorderColor
return Color

BorderThickness public property

The thickness of the border drawn for the button.
public int BorderThickness
return int

FillColor public property

The color of the button background.
public Color FillColor
return Color

Position public property

The position of the top-left corner of the button.
public Vector2 Position
return Vector2

Size public property

The size of the button.
public Vector2 Size
return Vector2

Text public property

The text displayed in the button.
public string Text
return string

TextColor public property

The color of the text.
public Color TextColor
return Color