Class Index | File Index

Classes


Class R.rendercontexts.HTMLElementContext


Extends R.rendercontexts.RenderContext2D.
A wrapper for any HTML element to convert it into a targetable render context. The R.rendercontexts.DocumentContext and R.rendercontexts.HTMLDivContext use this as their base class.
Defined in: htmlelementcontext.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Create an instance of an HTML element rendering context.
Fields borrowed from class R.rendercontexts.RenderContext2D:
FONT_ALIGN_CENTER, FONT_ALIGN_END, FONT_ALIGN_LEFT, FONT_ALIGN_RIGHT, FONT_ALIGN_START, FONT_BASELINE_ALPHABETIC, FONT_BASELINE_BOTTOM, FONT_BASELINE_HANGING, FONT_BASELINE_IDEOGRAPHIC, FONT_BASELINE_MIDDLE, FONT_BASELINE_TOP, FONT_STYLE_ITALIC, FONT_STYLE_NORMAL, FONT_STYLE_OBLIQUE, FONT_WEIGHT_BOLD, FONT_WEIGHT_LIGHT, FONT_WEIGHT_NORMAL
Fields borrowed from class R.struct.Container:
EMPTY
Method Summary
Method Attributes Method Name and Description
 
add(obj)
Add an object to the context, or creates an element to represent the object.
 
Destroy the context and any objects within the context.
 
drawElement(ref, el, pos)
Draw an element on the context.
 
Draw a filled rectangle on the context.
 
drawImage(rect, image, srcRect, ref)
Draw an image on the context.
 
drawPoint(point, ref)
Draw a point on the context.
 
drawRectangle(rect, ref)
Draw an un-filled rectangle on the context.
 
drawSprite(sprite, time, dt, ref)
Draw a sprite on the context.
 
drawText(point, text, ref)
Draw text on the context.
 
Get the class name of this object
 
Pop a transform state off the stack.
 
Push a transform state onto the stack.
 
remove(obj)
Remove an object from the context.
 
Set the background color of the context.
 
setHeight(height)
Set the height of the context drawing area
 
setPosition(point)
Set the current transform position (translation).
 
setRotation(angle)
Set the rotation angle of the current transform
 
setScale(scaleX, scaleY)
Set the scale of the current transform.
 
setWidth(width)
Set the width of the context drawing area.
Methods borrowed from class R.rendercontexts.RenderContext2D:
arcTo, bezierCurveTo, cleanUp, drawArc, drawCircle, drawFilledArc, drawFilledCircle, drawFilledPolygon, drawFilledRegularPolygon, drawLine, drawPolygon, drawPolyline, drawRegularPolygon, endPath, fillPath, getBackgroundColor, getBoundingBox, getFillStyle, getFont, getFontAlign, getFontBaseline, getFontSize, getFontStyle, getFontWeight, getHeight, getImage, getLineStyle, getLineWidth, getNormalizedFont, getPosition, getRenderPosition, getRenderRotation, getRenderScale, getRotation, getScaleX, getScaleY, getTextMetrics, getTransform, getWidth, lineSeg, lineTo, moveTo, postRender, putImage, quadraticCurveTo, release, render, renderBin, setFillStyle, setFont, setFontAlign, setFontBaseline, setFontSize, setFontStyle, setFontWeight, setLineStyle, setLineWidth, setRenderTransform, setTransform, sort, sortFn, startPath, strokePath, swapBins
Methods borrowed from class R.rendercontexts.AbstractRenderContext:
captureMouse, captureTouch, getContextData, getExpandedViewport, getMouseInfo, getSurface, getTouchInfo, getViewport, getWorldBoundary, getWorldPosition, getWorldRotation, getWorldScale, isStatic, removeAtIndex, renderObject, reset, resetTransformStack, setStatic, setSurface, setupWorld, setViewport, setWorldBoundary, setWorldPosition, setWorldRotation, setWorldScale, uncaptureMouse, uncaptureTouch, update
Methods borrowed from class R.struct.Container:
addAll, append, clear, clone, concat, contains, filter, forEach, fromArray, get, getAll, getObjects, getProperties, insert, iterator, reduce, replace, replaceAt, size, subset, toXML
Methods borrowed from class R.engine.BaseObject:
addEvent, addEvents, getElement, jQ, removeEvent, setElement, triggerEvent
Methods borrowed from class R.engine.PooledObject:
clearObjectDataModel, getId, getName, getObjectDataModel, isDestroyed, setName, setObjectDataModel, toString
Class Detail
R.rendercontexts.HTMLElementContext(name, element)
Create an instance of an HTML element rendering context. This context represents any HTML element.
Parameters:
name
{String} The name of the context
element
{Number} The element which is the surface of the context.
Method Detail
add(obj)
Add an object to the context, or creates an element to represent the object. Objects added to the HTMLElementContext need a DOM representation, otherwise one will be created for the object being added.
Parameters:
obj
{HTMLElement} The element, or null

destroy()
Destroy the context and any objects within the context.

drawElement(ref, el, pos)
Draw an element on the context.
Parameters:
ref
{R.engine.GameObject} A reference game object
el Optional
{HTMLElement} A DOM element to draw
pos

{HTMLElement} drawFilledRectangle(rect, ref)
Draw a filled rectangle on the context. Unless ref is provided, a div element will be added to the render context.
Parameters:
rect
{R.math.Rectangle2D} The rectangle to draw
ref
{R.engine.GameObject} A reference game object
Returns:
{HTMLElement} The element added to the DOM

{HTMLElement} drawImage(rect, image, srcRect, ref)
Draw an image on the context. Unless ref is provided, a new image will be added to the render context.
Parameters:
rect
{R.math.Rectangle2D} The rectangle that specifies the position and dimensions of the image rectangle.
image
{HTMLImage} The image to draw onto the context
srcRect Optional
{R.math.Rectangle2D} [optional] The source rectangle within the image, if null the entire image is used
ref Optional
{R.engine.GameObject} A reference game object
Returns:
{HTMLElement} The element added to the DOM

{HTMLElement} drawPoint(point, ref)
Draw a point on the context. Unless ref is provided, a new image will be added to the render context.
Parameters:
point
{R.math.Point2D} The position to draw the point
ref
{R.engine.GameObject} A reference game object
Returns:
{HTMLElement} The element added to the DOM

{HTMLElement} drawRectangle(rect, ref)
Draw an un-filled rectangle on the context. Unless ref is provided, a div element will be added to the render context.
Parameters:
rect
{R.math.Rectangle2D} The rectangle to draw
ref
{R.engine.GameObject} A reference game object
Returns:
{HTMLElement} The element added to the DOM

{HTMLElement} drawSprite(sprite, time, dt, ref)
Draw a sprite on the context. Unless ref is provided, a new image will be added to the render context.
Parameters:
sprite
{R.resources.types.Sprite} The sprite to draw
time
{Number} The current world time
dt
{Number} The delta between the world time and the last time the world was updated in milliseconds.
ref
{R.math.HostObject} A reference game object
Returns:
{HTMLElement} The element added to the DOM

{HTMLElement} drawText(point, text, ref)
Draw text on the context. Unless ref is provided, a span element will be added to the render context.
Parameters:
point
{R.math.Point2D} The top-left position to draw the image.
text
{String} The text to draw
ref
{R.engine.GameObject} A reference game object
Returns:
{HTMLElement} The element added to the DOM

{String} getClassName()
Get the class name of this object
Returns:
{String} The string "R.rendercontexts.HTMLElementContext"

popTransform()
Pop a transform state off the stack.

pushTransform()
Push a transform state onto the stack.

remove(obj)
Remove an object from the context.
Parameters:
obj
{HTMLElement} The object to remove

setBackgroundColor(color)
Set the background color of the context.
Parameters:
color
{String} An HTML color

setHeight(height)
Set the height of the context drawing area
Parameters:
height
{Number} The height in pixels

setPosition(point)
Set the current transform position (translation).
Parameters:
point
{R.math.Point2D} The translation

setRotation(angle)
Set the rotation angle of the current transform
Parameters:
angle
{Number} An angle in degrees

setScale(scaleX, scaleY)
Set the scale of the current transform. Specifying only the first parameter implies a uniform scale.
Parameters:
scaleX
{Number} The X scaling factor, with 1 being 100%
scaleY
{Number} The Y scaling factor

setWidth(width)
Set the width of the context drawing area.
Parameters:
width
{Number} The width in pixels

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