Developer   API   Game Development   Game2D   TextButton

  •  Config(0)
  •  Properties(18)
  •  Methods(14)
  •  Events(2)

TextButton : GameButton

TextButton class is used to show simple text on the screen with GameControl features. You do not need to specify image for this object. What is required is to specify Moscrif paint instance with typeFace object.

Properties

  • defaults : Object
    Sets default controls options.
  • frame : Integer
    Get frame index.
  • frameHeight : Integer
    Set frame height.
  • frameWidth : Integer
    Set frame width.
  • image : Bitmap
    Game object image.
  • name : String
    Name of the game object.
  • options : Object
    Position of navigation bar.
  • paint : Paint
    Object used for final decoration.
  • scale : Float
    Scale of the game object.
  • scaledHeight : Integer
    Get scaled height of this object.
  • scaledWidth : Integer
    Get scaled width of this object.
  • sequence : Array
    Sequence of the frames.
  • text : String
    Text of the TextButton
  • this
    Construct of the object calls following method in order.
  • visible : Boolean
    Visibility of game object. Default is set to visibility true.
  • width : Integer
    Width of TextButton.
  • x : Integer
    X - coordinates of view's position.
  • y : Integer
    Y - coordinates of view's position.

Methods

  • _initObject()
    Function to set object's parameters, this function is called within draw for the forst time, or if object was changed.
  • _setObject : Integer
    Setting up textButton properties. Based on text and typeFace object, width and height is set. Anchor on X,Y coordinate is recalculated based on width and height.
  • afterInitControls
    Method is executed after init controls.
  • beforeInitControls
    Method is executed before init controls.
  • draw(canvas) : Integer
    Draw of the TextButton.
  • height : Integer
    Height of TextButton.
  • init() : GameControl
    Init Game control instance.
  • init()
    Object initialisation.
  • intersectsBounds(obj) : Boolean
    Check intersects by object.
  • intersectsPoint(x, y) : Boolean
    Check intersects by Location(x and y coordinate).
  • nextFrame(rewind = true)
    Get next Frame.
  • prevFrame(rewind = true)
    Get previous frame.
  • process()
    Call on process handler if defined.
  • undefined(k,v)
    Special property executed when priperty is undefined. It can be that JSON format is in format "key" : "value". Key is an string, so if this is the case methot return "value". Ass well as k is a regular property of the class it returns getter of this property.

Events

  • onClick(sender) : Function
    Event fired, within pointer pressed event.
  • onProcess(sender) : Function
    Event on process handler. It defines what suppose to be done on game process.