Documentation

WHAT WE GOT

AABB
Physics Environment

Animation
Actions & Animations

Array
Support Classes

Audio
Sounds & Music

Audio Effect
Sounds & Music

Background Audio
Sounds & Music

Bezier
Actions & Animations

Blink
Actions & Animations

Body
Physics Environment

Callback
Actions & Animations

Chain Shape
Physics Environment

Circle Shape
Physics Environment

Color
Support Classes

Delay
Actions & Animations

Device
Support Classes

Director
Essentials

Ease
Actions & Animations

Edge Shape
Physics Environment

Event
Support Classes

Fade
Actions & Animations

Filter
Physics Environment

Fixture
Physics Environment

Jump
Actions & Animations

Label
User Interface

Layer
Essentials

Layer Color
Essentials

Liquid
Actions & Animations

Mass Data
Physics Environment

Menu
User Interface

Menu Image
User Interface

Menu Label
User Interface

Move
Actions & Animations

Numeric
Support Clases

Object Layer
Tiled Maps

Physics Sprite
Physics Environment

Place
Actions & Animations

Point
Support Classes

Polygon Shape
Physics Environment

Repeat
Actions & Animations

Rotate
Actions & Animations

Scale
Actions & Animations

Scene
Essentials

Screen
Support Classes

Sequence
Actions & Animations

Shape
Physics Environment

Shuffle
Actions & Animations

Size
Support Classes

Skew
Actions & Animations

Spawn
Actions & Animations

Split
Actions & Animations

Sprite
Essentials

Sprite Batch
Essentials

Sprite Frame Cache
Essentials

Tile Layer
Tiled Maps

Tile Map
Tiled Maps

Tile Set
Tiled Maps

Tint
Actions & Animations

Touch
Support Classes

Turn
Actions & Animations

Twirl
Actions & Animations

Visibility
Actions & Animations

Wave
Actions & Animations

Wiggle
Actions & Animations

World
Physics Environment

USER INTERFACE

Label

The Label class is responsible for rendering text on the screen.

::TextAlignmentLeft

::TextAlignmentCenter

::TextAlignmentRight

Constants that represent the horizontal text alignment.

::TextAlignmentTop

::TextAlignmentCenter

::TextAlignmentBottom

Vertical text alignment constants.

::LineBreakWordWrap

::LineBreakCharacterWrap

::LineBreakClip

::LineBreakHeadTruncation

::LineBreakTailTruncation

::LineBreakMiddleTruncation

Line break mode values.

New

Creates a new instance of the Label class:

label = Label.new text: 'To the infinity and beyond'

Options

color: - Color - Default: White
Sets the Label's text color.

position: - Point - Default: None
The position of the label on the screen.

font_name: - String - Default: 'Marker Felt'
Sets the name of the font to be used to render the text.

More intel!

All the device's fonts are supported, either OSX or iOS.

font_size: - Integer - Default: 12
The size of the font to be render.

dimensions: - Size - Default: The rendered text dimensions
Sets the Label's dimensions.

alignment: - Constant - Default: TextAlignmentCenter
Label's horizontal text alignment.

vertical_alignment: - Constant - Default: TextAlignmentTop
Vertical text alignment of the Label.

line_break_mode: - Constant - Default: LineBreakWordWrap
Sets the Label's line break mode.

Text

Gets or Sets the Label's text:

label.text = 'To the infinity and beyond'

p "The label text is: #{label.text}"

Position

Retrieves or updates the position of the Label:

label.position = [100, 100]

p "The label position is: #{label.position.x}, #{label.position.y}"

Color

Gets or sets the Label's text color:

label.color = '800617'.to_color

Alignment

Retrieves or updates the horizontal alignment:

label.alignment = Label::TextAlignmentLeft

# The following is true
label.alignment == Label::TextAlignmentLeft

Vertical Alignment

Gets or sets the Label's vertical alignment:

label.vertical_alignment = Label::TextAlignmentCenter

# The following is true
label.vertical_alignment == Label::TextAlignmentCenter

Font Name

Retrieves or updates the Label's font name:

label.font_name = 'Helvetica'

p "The label font name is: #{label.font_name}"

Font Size

Gets or sets the font size of the Label:

label.font_size = 14

p "The label font size is: #{label.font_size}"