The game instance.
Creates a pixel font renderer function.
Optional
image: HTMLImageElementThe image containing the pixel font.
Optional
fontSize: numberThe size of each character in the pixel font.
Optional
color: string = 'white'The color to apply to the pixel font.
The pixel font renderer function.
Draws a 2D image on the canvas.
The HTMLImageElement representing the image to be drawn.
The bounding box of the image.
The scale factor to apply to the image (default: 1).
The rotation angle of the image in radians (default: 0).
Whether to flip the image horizontally (default: false).
Whether to flip the image vertically (default: false).
Optional
clip: VectorThe clipping region of the image (optional).
Optional
context: CanvasRenderingContext2DThe CanvasRenderingContext2D to use for drawing (optional).
Draws a stroke using the provided points.
The x-coordinate of the starting point.
The y-coordinate of the starting point.
An array of Vector objects representing the points to be connected.
The width of the stroke line (default: 1).
Renders text on the canvas.
The text to render.
The position to render the text.
Optional
color: ColorThe color of the text. Defaults to white.
The font size of the text. Defaults to '1em'.
The horizontal alignment of the text. Defaults to 'left'.
The vertical alignment of the text. Defaults to 'top'.
Whether to stroke the text. Defaults to false.
The
Draw
class provides methods for drawing shapes, text, and images on a canvas.