API Document Index



Class me.Viewport


Extends me.Rect.

Defined in: <build/melonJS-0.9.3.js>.

Class Summary
Constructor Attributes Constructor Name and Description
 
me.Viewport(minX, minY, maxX, maxY, realw, realh)
a camera/viewport Object
Field Summary
Field Attributes Field Name and Description
 
Axis constant
Fields borrowed from class me.Rect:
bottom, height, left, pos, right, top, width
Method Summary
Method Attributes Method Name and Description
 
fadeIn(color, duration, onComplete)
fadeIn effect

fade to the specified color

 
fadeOut(color, duration, onComplete)
fadeOut(flash) effect

screen is filled with the specified color and slowy goes back to normal

 
follow(Object, axis)
set the viewport to follow the specified entity
 
return the viewport height
 
return the viewport width
 
isVisible(rect)
check if the specified rectange is in the viewport
 
move(x, y)
move the viewport to the specified coordinates
 
reset(x, y)
reset the viewport to specified coordinates
 
setBounds(w, h)
set the viewport bound (real world limit)
 
Change the deadzone settings
 
shake(intensity, duration, axis, onComplete)
shake the camera
Methods borrowed from class me.Rect:
contains, containsPoint, getRect, overlaps, set, union, within
Class Detail
me.Viewport(minX, minY, maxX, maxY, realw, realh)
a camera/viewport Object
Parameters:
{int} minX
start x offset
{int} minY
start y offset
{int} maxX
end x offset
{int} maxY
end y offset
{int} realw Optional
real world width limit
{int} realh Optional
real world height limit
Field Detail
AXIS
Axis constant
Method Detail
fadeIn(color, duration, onComplete)
fadeIn effect

fade to the specified color

Parameters:
{string} color
in #rrggbb format
{int} duration Optional, Default: "1000"
in ms
{function} onComplete Optional
callback once effect is over

fadeOut(color, duration, onComplete)
fadeOut(flash) effect

screen is filled with the specified color and slowy goes back to normal

Parameters:
{string} color
in #rrggbb format
{Int} duration Optional, Default: "1000"
in ms
{function} onComplete Optional
callback once effect is over

follow(Object, axis)
set the viewport to follow the specified entity
Parameters:
{Object} Object
ObjectEntity or Position Vector to follow
{axis} axis Optional, Default: "AXIS.BOTH"
AXIS.HORIZONTAL, AXIS.VERTICAL, AXIS.BOTH

{int} getHeight()
return the viewport height
Returns:
{int}

{int} getWidth()
return the viewport width
Returns:
{int}

{boolean} isVisible(rect)
check if the specified rectange is in the viewport
Parameters:
{me.Rect} rect
Returns:
{boolean}

move(x, y)
move the viewport to the specified coordinates
Parameters:
{int} x
{int} y

reset(x, y)
reset the viewport to specified coordinates
Parameters:
{int} x
{int} y

setBounds(w, h)
set the viewport bound (real world limit)
Parameters:
{int} w
real world width
{int} h
real world height

setDeadzone(w, h)
Change the deadzone settings
Parameters:
{int} w
deadzone width
{int} h
deadzone height

shake(intensity, duration, axis, onComplete)
shake the camera
// shake it baby !
me.game.viewport.shake(10, 30, me.game.viewport.AXIS.BOTH);
Parameters:
{int} intensity
maximum offset that the screen can be moved while shaking
{int} duration
expressed in frame
{axis} axis
specify on which axis you want the shake effect (AXIS.HORIZONTAL, AXIS.VERTICAL, AXIS.BOTH)
{function} onComplete Optional
callback once shaking effect is over

Documentation generated by JsDoc Toolkit 2.4.0 on Tue May 01 2012 12:00:51 GMT+0800 (CST)