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

SUPPORT CLASSES

Point

The RubyMotion's CGPoint class with some convenience methods for performing arithmetic operations required usually for collision detection and physics.

Level Up!

When needed, an Array can be converted to a Point using the 'to_point' method. For more information see the Array documentation page.

==

Evaluates to true if two points are equal using their X and Y values as reference:

# The following is true
[2, 3].to_point == [2, 3].to_point

+

Adds a number to both the X and Y values or, if the parameter is a second point, adds the X and Y values of a second point to X and Y:

# The following is [10, 10]
[3, 3].to_point + 7

# The following is [5, 10]
[3, 3].to_point + [2, 7].to_point

-

Subtracts a number from the both X and Y values or, if the parameter is a second point, subtracts the X and Y values of a second point from X and Y:

# The following is [5, 5]
[10, 10].to_point - 5

# The following is [4, 1]
[5, 5].to_point - [1, 4].to_point

*

Multiplies a number by both the X and Y values or, if the parameter is a second point, multiplies the X and Y values of a second point by X and Y:

# The following is [25, 25]
[5, 5].to_point * 5

# The following is [5, 25]
[5, 5].to_point * [1, 5].to_point

/

Divides a number by both the X and Y values or, if the parameter is a second point, divides the X and Y values of a second point by X and Y:

# The following is [1, 1]
[4, 4].to_point / 4

# The following is [4, 4]
[4, 20].to_point / [1, 5].to_point

Half

Returns the Point dividing X and Y by two:

# The following is [5, 5]
[10, 10].to_point.half

To OpenGL Coordinates

Converts the Point from UIKit coordinates to OpenGL coordinates:

touch.location_in_view.to_opengl_coordinates

From OpenGL Coordinates

Transforms the Point from OpenGL coordinates to UIKit coordinates:

sprite.position.from_opengl_coordinates

From Pixel Coordinates

Converts the Point from Pixel coordinates to Metric coordinates:

sprite.position.from_pixel_coordinates

To Pixel Coordinates

Converts the Point from Metric coordinates to Pixel coordinates:

body.position.to_pixel_coordinates

To Local Coordinates

Receives a Sprite, Layer or Scene as parameter and will convert the Point to the argument coordinates:

touch.location.to_local_coordinates(layer)
Level Up!

Very useful when the Layer presented is bigger than the Screen

From Local Coordinates

Converts the Point from the Sprite, Layer or Scene coordinates to World coordinates:

touch.location.from_local_coordinates(layer)
More intel!

Almost every method on Joybox will perform the accordingly coordinate conversions.