[oden] Move scaling entirely into JavaScript
Now the game controls its own resolution. We might want to further copy Love2D and generate resize events, I don't know.
This commit is contained in:
parent
994be3e493
commit
1cb30034f8
9 changed files with 176 additions and 58 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { cls } from "./graphics";
|
||||
import { cls, get_dimensions, scale } from "./graphics";
|
||||
import { since_start } from "./time";
|
||||
import { new_v2 } from "./vector";
|
||||
import { load_world, World, Level, draw_level } from "./level";
|
||||
|
|
@ -102,6 +102,13 @@ export function update() {
|
|||
export function draw() {
|
||||
cls(0.1, 0.2, 0.3);
|
||||
|
||||
const dimensions = get_dimensions();
|
||||
const s = Math.max(
|
||||
1,
|
||||
Math.floor(Math.min(dimensions[0] / 320, dimensions[1] / 240))
|
||||
);
|
||||
scale(s);
|
||||
|
||||
if (level != undefined) {
|
||||
draw_level(level, 0, 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue