onResize method

void onResize(
  1. int width,
  2. int height
)

This is called as soon as the dimension of the canvas changes. Bullseye2D provides a default implementation that updates the projection matrix, but you are free to overwrite it, and provide your custom implementation.

  • width: The new width of the canvas.
  • height: The new height of the canvas.

Implementation

void onResize(int width, int height) {
  gfx.setViewport(0, 0, width, height);
  gfx.set2DProjection(width: width.toDouble(), height: height.toDouble());
}