function update(game: Game, entity: Entity) {
let camera = game.World.Camera2D[entity];
camera.ViewportWidth = game.ViewportWidth;
camera.ViewportHeight = game.ViewportHeight;
let projection = camera.Projection;
let aspect = game.ViewportWidth / game.ViewportHeight;
if (projection.Radius[0] === 0 && projection.Radius[1] === 0) {
let radius = game.ViewportHeight / UNIT_PX / 2;
from_ortho(projection.Inverse, radius * aspect, radius);
} else {
let target_aspect = projection.Radius[0] / projection.Radius[1];
if (aspect < target_aspect) {
from_ortho(projection.Inverse, projection.Radius[0], projection.Radius[0] / aspect);
} else {
from_ortho(projection.Inverse, projection.Radius[1] * aspect, projection.Radius[1]);
}
}
invert(projection.Projection, projection.Inverse);
}