Skip to content

Commit

Permalink
Variable aspect
Browse files Browse the repository at this point in the history
  • Loading branch information
stasm committed Jan 13, 2020
1 parent 75af8a2 commit c7a751d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/systems/sys_camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ function update(game: Game, entity: Entity) {
if (camera.New || game.Resized) {
camera.New = false;
let aspect = game.Canvas3.width / game.Canvas3.height;
ortho_symmetric(camera.Projection, camera.Radius, camera.Radius * aspect, 1, 500);
if (aspect > 1) {
// Landscape orientation: radius = top.
ortho_symmetric(camera.Projection, camera.Radius, camera.Radius * aspect, 1, 500);
} else {
// Portrait orientation: radius = right.
ortho_symmetric(camera.Projection, camera.Radius / aspect, camera.Radius, 1, 500);
}
invert(camera.Unproject, camera.Projection);
}

Expand Down
2 changes: 1 addition & 1 deletion src/ui/Intro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function Intro() {
">
BACK<br>COUNTRY
<div onclick="$(${Action.GoToTown});" style="
font: italic bold small-caps 15vmin serif;
font: italic bold small-caps 13vmin serif;
border-top: 20px solid #d45230;
">
Play Now
Expand Down

0 comments on commit c7a751d

Please sign in to comment.