draw text in more types
This commit is contained in:
parent
3a23a9f218
commit
b5b4307025
2 changed files with 5 additions and 2 deletions
|
|
@ -83,7 +83,7 @@ fn draw_text(args: Vec<ast::Expr>) -> ast::Value {
|
||||||
}
|
}
|
||||||
_ => todo!(),
|
_ => todo!(),
|
||||||
};
|
};
|
||||||
mq::draw_text(&text, x, y, size, color);
|
mq::draw_text(&text, x * SCALE, y * SCALE, size * SCALE, color);
|
||||||
ast::UNIT_VALUE
|
ast::UNIT_VALUE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,6 +108,9 @@ fn to_f32(value: Option<&ast::Expr>) -> f32 {
|
||||||
fn to_string(value: Option<&ast::Expr>) -> String {
|
fn to_string(value: Option<&ast::Expr>) -> String {
|
||||||
match value {
|
match value {
|
||||||
Some(ast::Expr::Value(ast::Value::String(s))) => s.clone(),
|
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(),
|
_ => "".into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ pub fn draw(state: &mut State) {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(err) => println!("Error: {}", err),
|
Err(err) => println!("Error: {}", err),
|
||||||
}
|
}
|
||||||
draw_fps();
|
// draw_fps();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
println!(
|
println!(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue