diff --git a/dotscape b/dotscape index bfc1346..711e429 100755 Binary files a/dotscape and b/dotscape differ diff --git a/ffi/glfw-input.c b/ffi/glfw-input.c index 6bd6744..b9db0cb 100644 --- a/ffi/glfw-input.c +++ b/ffi/glfw-input.c @@ -6,7 +6,11 @@ int PRESS = GLFW_PRESS; int RELEASE = GLFW_RELEASE; int LEFT_MOUSE_BUTTON = GLFW_MOUSE_BUTTON_1; +int KEY_R = GLFW_KEY_R; int KEY_G = GLFW_KEY_G; +int KEY_B = GLFW_KEY_B; + +int KEY_T = GLFW_KEY_T; int KEY_Y = GLFW_KEY_Y; int KEY_Z = GLFW_KEY_Z; diff --git a/ffi/glfw-input.sml b/ffi/glfw-input.sml index 2d21d30..fac57ba 100644 --- a/ffi/glfw-input.sml +++ b/ffi/glfw-input.sml @@ -31,8 +31,15 @@ struct _export "mltonKeyCallback" public : (int * int * int * int -> unit) -> unit; val setKeyCallback = _import "setKeyCallback" public reentrant : window -> unit; + val (KEY_R, _) = + _symbol "KEY_R" public : ( unit -> int ) * ( int -> unit ); val (KEY_G, _) = _symbol "KEY_G" public : ( unit -> int ) * ( int -> unit ); + val (KEY_B, _) = + _symbol "KEY_B" public : ( unit -> int ) * ( int -> unit ); + + val (KEY_T, _) = + _symbol "KEY_T" public : ( unit -> int ) * ( int -> unit ); val (KEY_Y, _) = _symbol "KEY_Y" public : ( unit -> int ) * ( int -> unit ); val (KEY_Z, _) = diff --git a/functional-core/app/app-update.sml b/functional-core/app/app-update.sml index be47ea8..39245cd 100644 --- a/functional-core/app/app-update.sml +++ b/functional-core/app/app-update.sml @@ -412,7 +412,7 @@ struct | RESIZE_WINDOW {width, height} => resizeWindow (model, width, height) | UNDO_ACTION => undoAction model | REDO_ACTION => redoAction model - | KEY_G => toggleGraph model + | KEY_T => toggleGraph model | KEY_CTRL_S => getSaveTrianglesMsg model | KEY_CTRL_L => getLoadTrianglesMsg model | KEY_CTRL_E => getExportTrianglesMsg model diff --git a/imperative-shell/input-callbacks.sml b/imperative-shell/input-callbacks.sml index c0c88f5..6488561 100644 --- a/imperative-shell/input-callbacks.sml +++ b/imperative-shell/input-callbacks.sml @@ -37,10 +37,22 @@ struct andalso mods = 0x0002 then Mailbox.send (mailbox, REDO_ACTION) + else if + key = Input.KEY_R () andalso action <> Input.RELEASE () andalso mods = 0x0 + then + Mailbox.send (mailbox, KEY_R) else if key = Input.KEY_G () andalso action <> Input.RELEASE () andalso mods = 0x0 then Mailbox.send (mailbox, KEY_G) + else if + key = Input.KEY_B () andalso action <> Input.RELEASE () andalso mods = 0x0 + then + Mailbox.send (mailbox, KEY_B) + else if + key = Input.KEY_T () andalso action <> Input.RELEASE () andalso mods = 0x0 + then + Mailbox.send (mailbox, KEY_T) else if (* ctrl-s *) key = Input.KEY_S () andalso action = Input.PRESS () andalso mods = 0x002 diff --git a/message-types/input-msg.sml b/message-types/input-msg.sml index c74a9ac..a872938 100644 --- a/message-types/input-msg.sml +++ b/message-types/input-msg.sml @@ -7,7 +7,10 @@ sig | RESIZE_WINDOW of {width: int, height: int} | UNDO_ACTION | REDO_ACTION + | KEY_R | KEY_G + | KEY_B + | KEY_T | KEY_CTRL_S | KEY_CTRL_L | KEY_CTRL_E @@ -32,7 +35,10 @@ struct | RESIZE_WINDOW of {width: int, height: int} | UNDO_ACTION | REDO_ACTION + | KEY_R | KEY_G + | KEY_B + | KEY_T | KEY_CTRL_S | KEY_CTRL_L | KEY_CTRL_E