[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:
John Doty 2023-09-02 09:58:58 -07:00
parent 994be3e493
commit 1cb30034f8
9 changed files with 176 additions and 58 deletions

View file

@ -36,6 +36,16 @@ export function stroke(r: number, g: number, b: number, a: number = 1) {
core.stroke(r, g, b, a);
}
/**
* Set the current scale factor.
*
* @param x - The scale factor in the x dimension.
* @param y - The scale factor in the y dimension. If omitted, defaults to x.
*/
export function scale(x: number, y?: number) {
core.scale(x, y ?? x);
}
/**
* Print a message to the console.
*
@ -148,3 +158,10 @@ export function write_to_screen() {
export function write_to_texture(texture: Texture) {
core.write_to_texture(texture.id());
}
/**
* Get the dimensions of the screen.
*/
export function get_dimensions(): [number, number] {
return core.get_dimensions();
}