draw works
This commit is contained in:
parent
b9488506ce
commit
eb22107a80
3 changed files with 14 additions and 3 deletions
|
|
@ -5,13 +5,13 @@ let setup = fn() {
|
|||
};
|
||||
|
||||
let update = fn(state, input) {
|
||||
let new = 100;
|
||||
let new = 200;
|
||||
state.player.position.x = new;
|
||||
return state;
|
||||
};
|
||||
|
||||
let draw = fn(state) {
|
||||
frame_clear(0,0,0);
|
||||
frame_clear(0,90,state.player.position.x);
|
||||
};
|
||||
|
||||
let migrate = fn(state) {
|
||||
|
|
|
|||
|
|
@ -122,7 +122,16 @@ fn eval_expr(expr_env: &Env, state: &mut State, expr: &ast::Expr) -> Result<ast:
|
|||
v => Err(Error::NotARecord(v, Backtrace::capture())),
|
||||
},
|
||||
ast::Expr::Var(var) => {
|
||||
let value = expr_env.get(var)?.clone();
|
||||
let value = match expr_env.get(var) {
|
||||
Ok(value) => Ok(value.clone()),
|
||||
Err(err) => {
|
||||
if state.primitive_funcs.get(&var).is_some() {
|
||||
Ok(ast::Value::PrimitiveFunc(var.clone()))
|
||||
} else {
|
||||
Err(err)
|
||||
}
|
||||
}
|
||||
}?;
|
||||
eval_expr(expr_env, state, &ast::Expr::Value(value))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,8 +161,10 @@ pub fn draw(state: &mut State) {
|
|||
Err(err) => println!("Error: {}", err),
|
||||
}
|
||||
|
||||
/*
|
||||
println!(
|
||||
"{:#?}",
|
||||
interpret::value_to_stadnalone_expr(&state.state, state.game_state.clone())
|
||||
);
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue