draw text in more types

This commit is contained in:
me 2025-12-21 16:23:50 +02:00
parent 3a23a9f218
commit b5b4307025
2 changed files with 5 additions and 2 deletions

View file

@ -83,7 +83,7 @@ fn draw_text(args: Vec<ast::Expr>) -> 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(),
}
}

View file

@ -191,7 +191,7 @@ pub fn draw(state: &mut State) {
Ok(_) => {}
Err(err) => println!("Error: {}", err),
}
draw_fps();
// draw_fps();
/*
println!(