aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/app.rs7
-rw-r--r--src/lisp/eval.rs4
2 files changed, 9 insertions, 2 deletions
diff --git a/src/app.rs b/src/app.rs
index 008b273..d35febf 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -470,6 +470,11 @@ impl<'ctx> AppState<'ctx> {
470 self.draw(); 470 self.draw();
471 self.canvas.present(); 471 self.canvas.present();
472 } 472 }
473
474 pub fn quit(&mut self) {
475 let ev = self.context.event().unwrap();
476 ev.push_event(Event::Quit { timestamp: 0u32 });
477 }
473} 478}
474 479
475// publicly available functions on appstate 480// publicly available functions on appstate
@@ -606,8 +611,6 @@ impl<'ctx> AppState<'ctx> {
606 } 611 }
607 } 612 }
608 Keycode::V => self.cycle_symmetry(), 613 Keycode::V => self.cycle_symmetry(),
609 // exit
610 Keycode::Escape => break 'running,
611 // undo & redo 614 // undo & redo
612 Keycode::U => { 615 Keycode::U => {
613 if let Some(op) = self.undo_stack.undo() { 616 if let Some(op) = self.undo_stack.undo() {
diff --git a/src/lisp/eval.rs b/src/lisp/eval.rs
index 63c963c..8bfa86b 100644
--- a/src/lisp/eval.rs
+++ b/src/lisp/eval.rs
@@ -115,6 +115,10 @@ pub fn with_prelude() -> Environment {
115 Ok(LispExpr::Number(acc)) 115 Ok(LispExpr::Number(acc))
116 } 116 }
117 }); 117 });
118 primitive!(env, Some(0), "quit", |_, app| {
119 app.quit();
120 Ok(LispExpr::Unit)
121 });
118 env 122 env
119} 123}
120 124