Graphics (Extends from Container)

Module: engine.renderer.graphics

Properties

_cached Boolean (Default: false)

(No description yet)

_cachedSprite Sprite

(No description yet)

_cosCache Number (Default: 1)

(No description yet)

_interactive Boolean (Default: false)

(No description yet)

_lastTransformUpdate Number

(No description yet)

_localTransform Matrix

(No description yet)

_parent Container

(No description yet)

_rotationCache Number (Default: 0)

(No description yet)

_sinCache Number (Default: 0)

(No description yet)

_worldAlpha Number (Default: 1)

(No description yet)

_worldBounds Rectangle

(No description yet)

_worldTransform Matrix

(No description yet)

alpha Number (Default: 1)

Container opacity, 0 makes it invisible.

anchor Vector

(No description yet)

blendMode String (Default: source-over)

(No description yet)

buttonMode Boolean (Default: false)

Change cursor, when mouse is over the container. Define cursor at game.Input.buttonModeCursor.

cache Boolean (Default: false)

Cache container content as bitmap.

children Array

(No description yet)

fillAlpha Number (Default: 1)

(No description yet)

fillColor String (Default: #fff)

(No description yet)

height Number

(No description yet)

hitArea Rectangle|Circle

(No description yet)

interactive Boolean (Default: false)

(No description yet)

lineAlpha Number (Default: 1)

(No description yet)

lineColor String (Default: #fff)

(No description yet)

lineWidth Number (Default: 0)

(No description yet)

mask Graphics

(No description yet)

parent Container

(No description yet)

position Vector

(No description yet)

renderable Boolean (Default: true)

(No description yet)

rotation Number (Default: 0)

(No description yet)

scale Vector

(No description yet)

shapes Array

(No description yet)

skew Vector

(No description yet)

stage Container

(No description yet)

visible Boolean (Default: true)

Visibility. If set to false, rendering and interactivity will be disabled.

width Number

(No description yet)

x Number

Shorthand for position.x

y Number

Shorthand for position.y

Methods

_destroyCachedSprite()

(No description yet)

_drawShape(shape)

(No description yet)

Parameters:

  • shape Rectangle|Circle
_generateCachedSprite()

(No description yet)

_getBounds() Rectangle

(No description yet)

_worldBounds

_removeStageReference()

(No description yet)

_render(context)

(No description yet)

Parameters:

  • context CanvasRenderingContext2D
_renderCanvas(context)

(No description yet)

Parameters:

  • context CanvasRenderingContext2D
_renderChildren(context)

(No description yet)

Parameters:

  • context CanvasRenderingContext2D
_renderMask(context, transform)

(No description yet)

Parameters:

  • context CanvasRenderingContext2D
  • transform Matrix
_setStageReference(stage)

(No description yet)

Parameters:

  • stage Container
_updateChildTransform()

(No description yet)

_updateParentTransform()

(No description yet)

addChild(child)

(No description yet)

Parameters:

  • child Container
addChildAt(child, index)

(No description yet)

Parameters:

  • child Container
  • index Number
addTo(container, [index])

Add this to container.

Parameters:

  • container Container
  • index Number (optional)
anchorCenter()

(No description yet)

beginFill([color], [alpha])

(No description yet)

Parameters:

  • color String (optional)
  • alpha Number (optional)
center(target, [offsetX], [offsetY], [worldPos])

Position container to center of target.

Parameters:

  • target Container
  • offsetX Number (optional)
  • offsetY Number (optional)
  • worldPos Boolean (optional)

    Use world position.

clear()

(No description yet)

click(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event InputEvent
drawArc(x, y, radius, startAngle, endAngle)

(No description yet)

Parameters:

  • x Number
  • y Number
  • radius Number
  • startAngle Number
  • endAngle Number
drawCircle(x, y, radius)

(No description yet)

Parameters:

  • x Number
  • y Number
  • radius Number
drawCurve(sx, sy, ex, ey, h1x, h1y, h2x, h2y)

Draw bezier curve.

Parameters:

  • sx Curve|Number
  • sy Number
  • ex Number
  • ey Number
  • h1x Number
  • h1y Number
  • h2x Number
  • h2y Number
drawLine(sx, sy, tx, ty)

(No description yet)

Parameters:

  • sx Number

    Start x

  • sy Number

    Start y

  • tx Number

    End x

  • ty Number

    End y

drawPolygon(points, [close])

(No description yet)

Parameters:

  • points Array

    List of points.

  • close Boolean (optional)

    Close the polygon.

drawRect(x, y, width, height)

(No description yet)

Parameters:

  • x Number
  • y Number
  • width Number
  • height Number
hitTest(target) Boolean

Hit test container's hitArea against target's hitArea or target vector.

Parameters:

  • target Container|Vector
lineStyle([width], [color], [alpha])

(No description yet)

Parameters:

  • width Number (optional)
  • color String (optional)
  • alpha Number (optional)
mousedown(x, y, id, event) Boolean

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event InputEvent

Return true, to skip to next object.

mousemove(x, y, id, event) Boolean

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event InputEvent

Return true, to skip to next object.

mouseout(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event InputEvent
mouseover(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event InputEvent
mouseup(x, y, id, event) Boolean

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event InputEvent

Return true, to skip to next object.

mouseupoutside(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event InputEvent
onScreen() Boolean

Check if container is on the screen.

Return true, if on the screen.

remove()

Remove this from it's parent.

removeAll()

Remove all childrens.

removeChild(child)

Remove children.

Parameters:

  • child Container
swap(container)

Swap container drawing position with this container.

Parameters:

  • container Container
swapChildren(child, child2)

Swap drawing position of two childrens.

Parameters:

  • child Container
  • child2 Container
toBottom()

Move container to first children.

toTop()

Move container to last children.

toWorldPosition([vector], [local]) Vector

Get current world position

Parameters:

  • vector Vector (optional)

    Vector to set world position

  • local Boolean (optional)

    Convert world position to local position

Returns new Vector, if vector parameter not defined

updateTransform()

(No description yet)

Attributes

_canvas HTMLCanvasElement

(No description yet)

_context CanvasRenderingContext2D

(No description yet)