API Docs for:
Show:

gs.Renderer Class

The renderer is used to render graphical object on screen like images, colored rectangles, etc. It behaves like a state-machine. So first step is to set origin, rotation-angle, color, etc. and then render graphical objects with that settings.

Constructor

gs.Renderer

(
  • context
)

Parameters:

  • context Object
    • The graphics context.

Methods

changeTone

(
  • rect
)

Changes the color tone of the specified area. Needs to be called once per frame to keep it up.

Parameters:

clipRect

(
  • rect
)

Sets the current clip-rect. All render-calls outside of the clip-area are clipped.

Parameters:

clipTo

(
  • x
  • y
  • width
  • height
)

Sets the current clip-rect. All render-calls outside of the clip-area are clipped. It is equivalent to clipRect but takes direct coordinates instead of a gs.Rect.

Parameters:

  • x Number
    • The x coordinate of the clipping area.
  • y Number
    • The y coordinate of the clipping area.
  • width Number
    • The width of the clipping area.
  • height Number
    • The height of the clipping area.

dispose

()

Disposes the renderer and frees all allocated resources/memory.

drawBitmap

(
  • bitmap
  • x
  • y
  • srcRect
  • [ox=0]
  • [oy=0]
)

Draws a specified bitmap on screen.

Parameters:

  • bitmap gs.Bitmap
    • The bitmap to draw.
  • x Number
    • The x-coordinate of the bitmap's position.
  • y Number
    • The y-coordinate of the bitmap's position.
  • srcRect gs.Rect
    • The area of the bitmap to draw.
  • [ox=0] Number optional
    • The x-coordinate of the origin.
  • [oy=0] Number optional
    • The xycoordinate of the origin.

drawBitmapSimple

(
  • bitmap
  • x
  • y
  • w
  • h
  • sx
  • sy
  • sw
  • sh
)

Draws a bitmap "simple" without any visual effects like rotation, tinting, alpha-blending, etc. Its faster than regular gs.Renderer.drawBitmap.

Parameters:

  • bitmap gs.Bitmap
    • The bitmap to draw.
  • x Number
    • The x-coordinate of the bitmap's position.
  • y Number
    • The y-coordinate of the bitmap's position.
  • w Number
    • The width of the bitmap.
  • h Number
    • The height of the bitmap.
  • sx Number
    • The x-coordinate of the bitmap's area to draw.
  • sy Number
    • The y-coordinate of the bitmap's area to draw.
  • sw Number
    • The width of the bitmap's area to draw.
  • sh Number
    • The height of the bitmap's area to draw.

drawLive2D

(
  • object
)

Draws a Live2D object.

Parameters:

drawQuad

(
  • position
  • size
)

Draws a quad. The quad can be textured, rotated, tinted, etc. depending on the renderer settings.

Parameters:

  • position Number
    • The position as number-array.
  • size Number
    • The size as number-array.

setBitmap

(
  • bitmap
)

Sets the current bitmap to render.

Parameters:

setSourceRectangle

(
  • sx
  • sy
  • sw
  • sh
)

Sets the current source-rectangle to render.

Parameters:

  • sx Number
    • The x-coordinate of the area to draw.
  • sy Number
    • The y-coordinate of the area to draw.
  • sw Number
    • The width of the area to draw.
  • sh Number
    • The height of the area to draw.

Properties

anchor

gs.Vector2

The anchor-point.

angle

Number

The rotation angle.

blendType

gs.BlendMode

The blend mode.

clip

gs.Rect

The current clip-rect

color

gs.Color

The color.

context

Object

The graphics context.

effects

Object

The effect settings for different kind of visual effect like wobble, etc.

mirror

Boolean

Indicates if rendered images are mirrored/flipped horizontally.

opacity

Number

The opacity. Goes from 0 to 255.

ox

Number

The x-coordinate of the origin.

oy

Number

The y-coordinate of the origin.

tone

gs.Tone

The tone.

zoom

gs.Vector2

The zoom.