onGameResize method
Called whenever the size of the top-level Canvas changes.
In addition, this method will be invoked before each onMount.
Implementation
@mustCallSuper
@override
void onGameResize(Vector2 size) {
super.onGameResize(size);
if (!isFullscreen) {
return;
}
final Vector2 newSize;
if (parent is Viewport) {
newSize = (parent! as Viewport).virtualSize;
} else if (parent is ReadOnlySizeProvider) {
newSize = (parent! as ReadOnlySizeProvider).size;
} else {
newSize = game.size;
}
this.size.setFrom(newSize);
parallax?.resize(newSize);
}