Class Index | File Index

Classes


Class R.components.render.Vector2D


Extends R.components.Render.
A render component that renders its contents from an Array of points.
Defined in: vector2d.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates a 2d vector drawing component
Fields borrowed from class R.components.Render:
DRAW, NO_DRAW
Fields borrowed from class R.components.Base:
TYPE_COLLIDER, TYPE_INPUT, TYPE_LOGIC, TYPE_RENDERING, TYPE_TRANSFORM
Method Summary
Method Attributes Method Name and Description
 
Destroys the object instance
 
execute(renderContext, time, dt)
Draw the shape, defined by the points, to the rendering context using the specified line style and fill style.
 
Get the box which would enclose the shape
 
Get the center point from all of the points
 
getCircleHull(radiusPct)
Get a circular convex hull which encloses the points.
 
Get the class name of this object
 
Get a convex hull that would enclose the points.
 
Returns the fill style of the shape.
 
Returns the line style that will be used to draw this shape.
 
Returns the width of the lines used to draw the shape.
 
Get an Object Bounding Box (OBB) convex hull.
 
Release the component back into the object pool.
 
setClosed(closed)
Set whether or not we draw a polygon or polyline.
 
setFillStyle(fillStyle)
Set the color used to fill the shape.
 
setLineStyle(strokeStyle)
Set the color of the lines to be drawn for this shape.
 
setLineWidth(lineWidth)
Set the width of lines used to draw this shape.
 
setPoints(pointArray, noOffset)
Set the points which comprise the shape of the object to be rendered to the context.
 
Transform all of the points by the given matrix
Methods borrowed from class R.components.Render:
getDrawMode, setDrawMode, transformOrigin
Methods borrowed from class R.components.Base:
getGameObject, getHostObject, getPriority, getType, getTypeString, setGameObject, setHostObject, setPriority
Methods borrowed from class R.engine.BaseObject:
addEvent, addEvents, getElement, jQ, removeEvent, setElement, triggerEvent, update
Methods borrowed from class R.engine.PooledObject:
clearObjectDataModel, getId, getName, getObjectDataModel, getProperties, isDestroyed, setName, setObjectDataModel, toString, toXML
Class Detail
R.components.render.Vector2D(name, priority)
Creates a 2d vector drawing component
Parameters:
name
{String} The name of the component
priority Optional, Default: 0.1
{Number} The priority of the component
Method Detail
destroy()
Destroys the object instance

execute(renderContext, time, dt)
Draw the shape, defined by the points, to the rendering context using the specified line style and fill style.
Parameters:
renderContext
{R.rendercontexts.AbstractRenderContext} The context to render to
time
{Number} The engine time in milliseconds
dt
{Number} The delta between the world time and the last time the world was updated in milliseconds.

{R.math.Rectangle2D} getBoundingBox()
Get the box which would enclose the shape
Returns:
{R.math.Rectangle2D}

{R.math.Point2D} getCenter()
Get the center point from all of the points
Returns:
{R.math.Point2D}

{R.collision.CircleHull} getCircleHull(radiusPct)
Get a circular convex hull which encloses the points.
Parameters:
radiusPct
{Number} A percentage of the calculated radius of the points, or null
Returns:
{R.collision.CircleHull} A convex hull

{String} getClassName()
Get the class name of this object
Returns:
{String} "R.components.render.Vector2D"

{R.collision.ConvexHull} getConvexHull(lod)
Get a convex hull that would enclose the points. The the LOD isn't specified, it will be assumed to be 4.
Parameters:
lod Optional
{Number} The level of detail for the hull.
Returns:
{R.collision.ConvexHull} A convex hull

{String} getFillStyle()
Returns the fill style of the shape.
Returns:
{String}

{String} getLineStyle()
Returns the line style that will be used to draw this shape.
Returns:
{String}

{Number} getLineWidth()
Returns the width of the lines used to draw the shape.
Returns:
{Number}

{R.collision.OBBHull} getOBBHull()
Get an Object Bounding Box (OBB) convex hull.
Returns:
{R.collision.OBBHull} A convex hull

release()
Release the component back into the object pool. See PooledObject#release for more information.

setClosed(closed)
Set whether or not we draw a polygon or polyline. true to draw a polygon (the path formed by the points is a closed loop.
Parameters:
closed
{Boolean}

setFillStyle(fillStyle)
Set the color used to fill the shape.
Parameters:
fillStyle
{String} The HTML color used to fill the shape.

setLineStyle(strokeStyle)
Set the color of the lines to be drawn for this shape.
Parameters:
strokeStyle
{String} The HTML color of the stroke (lines) of the shape

setLineWidth(lineWidth)
Set the width of lines used to draw this shape.
Parameters:
lineWidth
{Number} The width of lines in the shape

setPoints(pointArray, noOffset)
Set the points which comprise the shape of the object to be rendered to the context.
Parameters:
pointArray
{Array} An array of Point2D instances
noOffset
{Boolean} If true, does not offset the points relative to their center. For objects not drawn around a center point, this allows you to pass the points literally without translation.

transformPoints(matrix)
Transform all of the points by the given matrix
Parameters:
matrix
{Matrix}

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Mar 18 2013 16:09:18 GMT-0400 (EDT)