diff --git a/dotscape b/dotscape index 6755356..d60ade2 100755 Binary files a/dotscape and b/dotscape differ diff --git a/ffi/glfw-input.c b/ffi/glfw-input.c index 6da5b7d..b95df23 100644 --- a/ffi/glfw-input.c +++ b/ffi/glfw-input.c @@ -22,6 +22,7 @@ int KEY_O = GLFW_KEY_O; int KEY_A = GLFW_KEY_A; int KEY_W = GLFW_KEY_W; int KEY_H = GLFW_KEY_H; +int KEY_C = GLFW_KEY_C; int KEY_ENTER = GLFW_KEY_ENTER; int KEY_SPACE = GLFW_KEY_SPACE; diff --git a/ffi/glfw-input.sml b/ffi/glfw-input.sml index fe604e4..24c2662 100644 --- a/ffi/glfw-input.sml +++ b/ffi/glfw-input.sml @@ -37,6 +37,8 @@ struct _symbol "KEY_G" public : ( unit -> int ) * ( int -> unit ); val (KEY_B, _) = _symbol "KEY_B" public : ( unit -> int ) * ( int -> unit ); + val (KEY_C, _) = + _symbol "KEY_C" public : ( unit -> int ) * ( int -> unit ); val (KEY_T, _) = _symbol "KEY_T" public : ( unit -> int ) * ( int -> unit ); diff --git a/imperative-shell/file-thread.sml b/imperative-shell/file-thread.sml index c36a0eb..a0a97b3 100644 --- a/imperative-shell/file-thread.sml +++ b/imperative-shell/file-thread.sml @@ -11,6 +11,7 @@ struct val structureName = "Green" val filename = "green.dsc" val exportFilename = "green.sml" + val collisionFilename = "green-collisions.sml" fun loadIO (io, str) = case TextIO.inputLine io of @@ -33,18 +34,10 @@ struct | NONE => () end - fun saveSquares squaresString = + fun saveString (filename, toSaveString) = let val io = TextIO.openOut filename - val () = TextIO.output (io, squaresString) - in - TextIO.closeOut io - end - - fun exportSquares squaresString = - let - val io = TextIO.openOut exportFilename - val () = TextIO.output (io, squaresString) + val () = TextIO.output (io, toSaveString) in TextIO.closeOut io end @@ -83,9 +76,10 @@ struct let val _ = case Mailbox.recv fileMailbox of - SAVE_SQUARES str => saveSquares str + SAVE_SQUARES str => saveString (filename, str) + | EXPORT_SQUARES str => saveString (exportFilename, str) + | EXPORT_COLLISIONS str => saveString (collisionFilename, str) | LOAD_SQUARES => loadSquares (filename, inputMailbox) - | EXPORT_SQUARES str => exportSquares str | LOAD_FILES path => loadFiles (path, inputMailbox) | SELECT_PATH path => selectPath (path, inputMailbox) in diff --git a/imperative-shell/input-callbacks.sml b/imperative-shell/input-callbacks.sml index c28d8cf..b75b82d 100644 --- a/imperative-shell/input-callbacks.sml +++ b/imperative-shell/input-callbacks.sml @@ -68,6 +68,11 @@ struct key = Input.KEY_E () andalso action = Input.PRESS () andalso mods = 0x002 then Mailbox.send (mailbox, KEY_CTRL_E) + else if + (* ctrl-c *) + key = Input.KEY_C () andalso action = Input.PRESS () andalso mods = 0x002 + then + Mailbox.send (mailbox, KEY_CTRL_C) else if key = Input.KEY_A () andalso action = Input.PRESS () andalso mods = 0 then