FGGE  v0.7
Fabiogiopla HTML5 Game Engine
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | List of all members
GameEngine.GUI.Button Class Reference

Clickable button. More...

Public Member Functions

 Button (var x, var y, var width, var height, var text)
 Create a button.
 
 render ()
 Draw the button.
 

Public Attributes

var x
 Coordinate X.
 
var y
 Coordinate Y.
 
var width
 Width of the button.
 
var height
 Height of the button.
 
var text
 Text in the button.
 
var enabled
 Defines if button is interactable.
 

Detailed Description

Clickable button.

This is just a clickable button.

Constructor & Destructor Documentation

GameEngine.GUI.Button.Button ( var  x,
var  y,
var  width,
var  height,
var  text 
)

Create a button.

Create a button that can be rendered on the canvas.

var btnSimpleButton = new GameEngine.GUI.Button(10, 10, 300, 30, "Click me!");
Parameters
xThe X coordinate of button on canvas.
yThe Y coordinate of button on canvas.
widthThe width of the button in pixels.
heightThe height of the button in pixels.
textThe text inside the button.

Member Function Documentation

GameEngine.GUI.Button.render ( )

Draw the button.

The button gets drawn on the canvas (automatically manages mouse events).

Returns
true if button is clicked, false otherwise.

Member Data Documentation

var GameEngine.GUI.Button.enabled

Defines if button is interactable.

If enabled the button can be clicked, else it won't respond to input.

var GameEngine.GUI.Button.height

Height of the button.

Height of the button in pixels.

var GameEngine.GUI.Button.text

Text in the button.

The text that the button contains.

var GameEngine.GUI.Button.width

Width of the button.

Width of the button in pixels.

var GameEngine.GUI.Button.x

Coordinate X.

The X coordinate on the canvas of the button (from left).

var GameEngine.GUI.Button.y

Coordinate Y.

The Y coordinate on the canvas of the button (from top).