[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
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue