Canvas.draw() - newo2001/HTML5-Canvas-Wrapper GitHub Wiki
Performs the user-defined part of the canvas' update routine.
The instance of the canvas class to draw.
Draws a rectangle to the canvas every game tick.
canvas.draw();
canvas (Canvas)
let canvas = new Canvas(new Vec2(50, 50), new Vec2(100, 200));
canvas.draw = function() {
canvas.clear();
canvas.rect(new Vec2(200, 200), new Vec2(100, 100));
canvas.swapBuffers();
}
- This function should not be called. Instead, you should override this function and add you own implentation. This is the function where you place all of your code that you want to be ran every game tick. This function is then called by the API when a new gametick is processed.