Home Reference Source Repository
import {Drawable} from 'webgame-lib/src/drawable.js'
public interface | source

Drawable

Direct Subclass:

Animation, Circle, Sprite, Square

An object that the camera is capable of culling and drawing to the screen.

Method Summary

Public Methods
public

bounds(rect: Rect)

Set the rectangular bounds of the section to draw.

public

Draws at given position.

Public Methods

public bounds(rect: Rect) source

Set the rectangular bounds of the section to draw.

Params:

NameTypeAttributeDescription
rect Rect

Object bounds

public draw(ctx: CanvasRenderingContext2D, x: number, y: number) source

Draws at given position.

Params:

NameTypeAttributeDescription
ctx CanvasRenderingContext2D

Render context

x number

Transformed x coordinate

y number

Transformed y coordinate