[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

@ -154,9 +154,11 @@ impl ScriptContext {
}
}
pub fn update(&mut self) {
pub fn update(&mut self, dimensions: (f32, f32)) {
let _span = span!("script update");
self.gfx.set_dimensions(dimensions);
if self.error_lines.len() > 0 {
return; // Don't bother, nothing.
}
@ -190,6 +192,7 @@ impl ScriptContext {
let _span = span!("script render");
if self.error_lines.len() > 0 {
// TODO: Use font 0 for a fallback.
// TODO: Scale!! Remember you're using a font at size 8 or something.
let mut commands = vec![
GraphicsCommand::Clear(ClearCommand {
color: [0.0, 0.0, 1.0, 1.0],