From b5b4307025ad0a1014eb6bbdac03544868836896 Mon Sep 17 00:00:00 2001 From: me Date: Sun, 21 Dec 2025 16:23:50 +0200 Subject: [PATCH] draw text in more types --- src/runtime/primitive_functions.rs | 5 ++++- src/runtime/runtime.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/runtime/primitive_functions.rs b/src/runtime/primitive_functions.rs index 4552d0f..ffbd9e3 100644 --- a/src/runtime/primitive_functions.rs +++ b/src/runtime/primitive_functions.rs @@ -83,7 +83,7 @@ fn draw_text(args: Vec) -> ast::Value { } _ => todo!(), }; - mq::draw_text(&text, x, y, size, color); + mq::draw_text(&text, x * SCALE, y * SCALE, size * SCALE, color); ast::UNIT_VALUE } @@ -108,6 +108,9 @@ fn to_f32(value: Option<&ast::Expr>) -> f32 { fn to_string(value: Option<&ast::Expr>) -> String { match value { Some(ast::Expr::Value(ast::Value::String(s))) => s.clone(), + Some(ast::Expr::Value(ast::Value::Float(f))) => format!("{f:.2}"), + Some(ast::Expr::Value(ast::Value::Int(i))) => format!("{i}"), + Some(ast::Expr::Value(ast::Value::Boolean(b))) => format!("{b}"), _ => "".into(), } } diff --git a/src/runtime/runtime.rs b/src/runtime/runtime.rs index 44c7be5..018260a 100644 --- a/src/runtime/runtime.rs +++ b/src/runtime/runtime.rs @@ -191,7 +191,7 @@ pub fn draw(state: &mut State) { Ok(_) => {} Err(err) => println!("Error: {}", err), } - draw_fps(); + // draw_fps(); /* println!(