# Class: BitmapText

## Phaser. BitmapText

BitmapText objects work by taking a texture file and an XML file that describes the font layout.

On Windows you can use the free app BMFont: http://www.angelcode.com/products/bmfont/ On OS X we recommend Glyph Designer: http://www.71squared.com/en/glyphdesigner For Web there is the great Littera: http://kvazars.com/littera/

#### new BitmapText(game, x, y, font, text, size)

  Creates a new BitmapText object.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `game` | Phaser.Game |  |  | A reference to the currently running game.
  `x` | number |  |  | X position of the new bitmapText object.
  `y` | number |  |  | Y position of the new bitmapText object.
  `font` | string |  |  | The key of the BitmapFont as stored in Game.Cache.
  `text` | string | <optional> | '' | The actual text that will be rendered. Can be set later via BitmapText.text.
  `size` | number | <optional> | 32 | The size the font will be rendered in, in pixels.

  Source:
    - gameobjects/BitmapText.js, line 26

### Members

#### align

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `align` | string | Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text.

  Source:
    - gameobjects/BitmapText.js, line 267

#### angle

  Indicates the rotation of the Text, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90. If you wish to work in radians instead of degrees use the property Sprite.rotation instead.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `angle` | number | Gets or sets the angle of rotation in degrees.

  Source:
    - gameobjects/BitmapText.js, line 311

#### cameraOffset

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `cameraOffset` | Phaser.Point | If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.

  Source:
    - gameobjects/BitmapText.js, line 110

#### destroyPhase

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `destroyPhase` | boolean | True if this object is currently being destroyed.

  Source:
    - gameobjects/BitmapText.js, line 473

#### events

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `events` | Phaser.Events | The Events you can subscribe to that are dispatched when certain things happen on this Sprite or its components.

  Source:
    - gameobjects/BitmapText.js, line 100

#### exists

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `exists` | boolean | If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all.

  Default Value:
    - true
  Source:
    - gameobjects/BitmapText.js, line 43

#### fixedToCamera

  An BitmapText that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in BitmapText.cameraOffset. Note that the cameraOffset values are in addition to any parent in the display list. So if this BitmapText was in a Group that has x: 200, then this will be added to the cameraOffset.x

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `fixedToCamera` | boolean | Set to true to fix this BitmapText to the Camera at its current world coordinates.

  Source:
    - gameobjects/BitmapText.js, line 442

#### font

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `font` | string | The font the text will be rendered in, i.e. 'Arial'. Must be loaded in the browser before use.

  Source:
    - gameobjects/BitmapText.js, line 330

#### fontSize

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `fontSize` | number | The size of the font in pixels.

  Source:
    - gameobjects/BitmapText.js, line 353

#### game

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `game` | Phaser.Game | A reference to the currently running Game.

  Source:
    - gameobjects/BitmapText.js, line 37

#### input

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `input` | Phaser.InputHandler | null | The Input Handler for this object. Needs to be enabled with image.inputEnabled = true before you can use it.

  Source:
    - gameobjects/BitmapText.js, line 105

#### inputEnabled

  By default a Text object won't process any input events at all. By setting inputEnabled to true the Phaser.InputHandler is activated for this object and it will then start to process click/touch events and more.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `inputEnabled` | boolean | Set to true to allow this object to receive input events.

  Source:
    - gameobjects/BitmapText.js, line 401

#### name

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `name` | string | The user defined name given to this BitmapText.

  Source:
    - gameobjects/BitmapText.js, line 49

#### text

  The text string to be displayed by this Text object, taking into account the style settings.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `text` | string | The text string to be displayed by this Text object, taking into account the style settings.

  Source:
    - gameobjects/BitmapText.js, line 378

#### text

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `text` | string | Set this value to update the text in this sprite. Carriage returns are automatically stripped out if multiLine is false. Text is converted to upper case if autoUpperCase is true.

  Source:
    - gameobjects/RetroFont.js, line 501

#### tint

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `tint` | number | The tint applied to the BitmapText. This is a hex value. Set to white to disable (0xFFFFFF)

  Source:
    - gameobjects/BitmapText.js, line 289

#### <readonly> type

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `type` | number | The const type of this object.

  Source:
    - gameobjects/BitmapText.js, line 55

#### world

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `world` | Phaser.Point | The world coordinates of this Sprite. This differs from the x/y coordinates which are relative to the Sprites container.

  Source:
    - gameobjects/BitmapText.js, line 65

#### z

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `z` | number | The z-depth value of this object within its Group (remember the World is a Group as well). No two objects in a Group can have the same z value.

  Source:
    - gameobjects/BitmapText.js, line 60

### Methods

#### destroy(destroyChildren)

  Destroy this BitmapText instance. This will remove any filters and un-parent any children.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `destroyChildren` | boolean | <optional> | true | Should every child of this object have its destroy method called?

  Source:
    - gameobjects/BitmapText.js, line 207

#### postUpdate()

  Automatically called by World.postUpdate.

  Source:
    - gameobjects/BitmapText.js, line 192

#### preUpdate()

  Automatically called by World.preUpdate.

  Source:
    - gameobjects/BitmapText.js, line 150

#### update()

  Override and use this function in your own custom objects to handle any update requirements you may have.

  Source:
    - gameobjects/BitmapText.js, line 183