Moai SDK  1.5 revision 1 (MoaiEdition)
MOAILayer2D Class Reference
Inheritance diagram for MOAILayer2D:
MOAIProp2D MOAITransform2D MOAIColor MOAIRenderable MOAITransformBase MOAINode MOAINode MOAIInstanceEventSource MOAIInstanceEventSource MOAIEventSource MOAIEventSource

List of all members.

Function List

  clear
  getFitting
  getPartition
  getSortMode
  getSortScale
  insertProp
  removeProp
  setBox2DWorld
  setCamera
  setCpSpace
  setFrameBuffer
  setParallax
  setPartition
  setSortMode
  setSortScale
  setViewport
  showDebugLines
  wndToWorld
  worldToWnd

Function Documentation

SUPPRESS_EMPTY_FILE_WARNING clear

Remove all props from the layer's partition.


function clear ( MOAILayer2D self )
Parameters:
self ( MOAILayer2D )
Returns:
nil

Computes a camera fitting for a given world rect along with an optional screen space padding. To do a fitting, compute the world rect based on whatever you are fitting to, use this method to get the fitting, then animate the camera to match.


function getFitting ( MOAILayer2D self, number xMin, number yMin, number xMax, number yMax [, number xPad, number yPad ] )
Parameters:
self ( MOAILayer2D )
xMin ( number )
yMin ( number )
xMax ( number )
yMax ( number )
xPad ( number ) Optional.
yPad ( number ) Optional.
Returns:
x ( number ), y ( number ), s ( number )

Returns the partition (if any) currently attached to this layer.


function getPartition ( MOAILayer2D self )
Parameters:
self ( MOAILayer2D )
Returns:
partition ( MOAIPartition )

Get the sort mode for rendering.


function getSortMode ( MOAILayer2D self )
Parameters:
self ( MOAILayer2D )
Returns:
sortMode ( number )

Return the scalar applied to axis sorts.


function getSortScale ( MOAILayer2D self )
Parameters:
self ( MOAILayer2D )
Returns:
x ( number ), y ( number ), priority ( number )

Adds a prop to the layer's partition.


function insertProp ( MOAILayer2D self, MOAIProp prop )
Parameters:
self ( MOAILayer2D )
prop ( MOAIProp )
Returns:
nil

Removes a prop from the layer's partition.


function removeProp ( MOAILayer2D self, MOAIProp prop )
Parameters:
self ( MOAILayer2D )
prop ( MOAIProp )
Returns:
nil

Sets a Box2D world for debug drawing.


function setBox2DWorld ( MOAILayer2D self, MOAIBox2DWorld world )
Parameters:
self ( MOAILayer2D )
world ( MOAIBox2DWorld )
Returns:
nil

Sets a camera for the layer. If no camera is supplied, layer will render using the identity matrix as view/proj.


function setCamera ( MOAILayer2D self [, MOAICamera2D camera ] )
Parameters:
self ( MOAILayer2D )
camera ( MOAICamera2D ) Optional. Default value is nil.
Returns:
nil
Note:

function setCamera ( MOAILayer2D self [, MOAICamera camera ] )
Parameters:
self ( MOAILayer2D )
camera ( MOAICamera ) Optional. Default value is nil.
Returns:
nil
Note:

Sets a Chipmunk space for debug drawing.


function setCpSpace ( MOAILayer2D self, MOAICpSpace space )
Parameters:
self ( MOAILayer2D )
space ( MOAICpSpace )
Returns:
nil

Attach a frame buffer. Layer will render to frame buffer instead of the main view.


function setFrameBuffer ( MOAILayer2D self, MOAIFrameBufferTexture frameBuffer )
Parameters:
self ( MOAILayer2D )
frameBuffer ( MOAIFrameBufferTexture )
Returns:
nil

Sets the parallax scale for this layer. This is simply a scalar applied to the view transform before rendering.


function setParallax ( MOAILayer2D self, number xParallax, number yParallax )
Parameters:
self ( MOAILayer2D )
xParallax ( number ) Default value is 1.
yParallax ( number ) Default value is 1.
Returns:
nil

Sets a partition for the layer to use. The layer will automatically create a partition when the first prop is added if no partition has been set.


function setPartition ( MOAILayer2D self, MOAIPartition partition )
Parameters:
self ( MOAILayer2D )
partition ( MOAIPartition )
Returns:
nil

Set the sort mode for rendering.


function setSortMode ( MOAILayer2D self, number sortMode )
Parameters:
self ( MOAILayer2D )
sortMode ( number ) One of MOAILayer2D.SORT_NONE, MOAILayer2D.SORT_PRIORITY_ASCENDING, MOAILayer2D.SORT_PRIORITY_DESCENDING, MOAILayer2D.SORT_X_ASCENDING, MOAILayer2D.SORT_X_DESCENDING, MOAILayer2D.SORT_Y_ASCENDING, MOAILayer2D.SORT_Y_DESCENDING
Returns:
nil

Set the scalar applied to axis sorts.


function setSortScale ( MOAILayer2D self [, number x, number y, number priority ] )
Parameters:
self ( MOAILayer2D )
x ( number ) Optional. Default value is 0.
y ( number ) Optional. Default value is 0.
priority ( number ) Optional. Default value is 1.
Returns:
nil

Set the layer's viewport.


function setViewport ( MOAILayer2D self, MOAIViewport viewport )
Parameters:
self ( MOAILayer2D )
viewport ( MOAIViewport )
Returns:
nil

Display debug lines for props in this layer.


function showDebugLines ( MOAILayer2D self [, boolean showDebugLines ] )
Parameters:
self ( MOAILayer2D )
showDebugLines ( boolean ) Optional. Default value is 'true'.
Returns:
nil

Project a point from window space into world space.


function wndToWorld ( MOAILayer2D self, number x, number y )
Parameters:
self ( MOAILayer2D )
x ( number )
y ( number )
Returns:
x ( number ), y ( number )

Transform a point from world space to window space.


function worldToWnd ( MOAILayer2D self, number x, number y )
Parameters:
self ( MOAILayer2D )
x ( number )
y ( number )
Returns:
x ( number ), y ( number )