Class Index | File Index

Classes


Class Button


Extends View.
button !CONSTRUCTOR PARAMETERS ARE PROVIDED IN A OBJECT LITERAL!
Defined in: gamejs-gui.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Button(image, image_down, image_hover, text, font, parent, size, position, surface, visible)
Field Summary
Field Attributes Field Name and Description
 
 
Label obejct, created if text was provided.
 
Fields borrowed from class View:
children, parent, position, size, surface
Method Summary
Method Attributes Method Name and Description
 
onClick(callback, scope)
short hand for on(EVT_BTN_CLICK, callback, scope)
 
default button paint implementation paints image, image_down or image_hover based on button sotate
 
setText(text)
set button text
Methods borrowed from class View:
addChild, blitChild, center, despatchEvent, destroy, draw, getGUI, getPosition, getRect, getSize, hide, isFocused, isHovered, isVisible, move, moveRelative, on, refresh, removeChild, resize, show, update
Class Detail
Button(image, image_down, image_hover, text, font, parent, size, position, surface, visible)
Parameters:
{gamejs.Surface} image
button image, OPTIONAL
{gamejs.Surface} image_down
button image when pressed down, OPTIONAL
{gamejs.Surface} image_hover
button image when hovered on, OPTIONAL
{String} text
text to display on button, OPTIONAL
{CachedFont} font
to render text with, OPTIONAL
{View} parent
parent element
{Array} size
array containing width & height of the element, eg. [width, height]
{Array} position
position of the view relative to parent, eg. [x, y]. OPTIONAL, default [0, 0]
{gamejs.Surface} surface
surface to render this view on, OPTIONAL
{Bool} visible
is this view visible? default true
Field Detail
{CachedFont} font

{Label} label
Label obejct, created if text was provided.

{String} text
Method Detail
onClick(callback, scope)
short hand for on(EVT_BTN_CLICK, callback, scope)
Parameters:
{Function} callback
function to call when EVT_BTN_CLICK event is triggered
{Object} scope
this object for callback, OPTIONAL

paint()
default button paint implementation paints image, image_down or image_hover based on button sotate

setText(text)
set button text
Parameters:
{String} text

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Aug 15 2011 16:17:32 GMT+0300 (EEST)