diff --git a/dotscape b/dotscape index 1865269..19c91ad 100755 Binary files a/dotscape and b/dotscape differ diff --git a/ffi/glfw-input.c b/ffi/glfw-input.c index bc9783c..e38acef 100644 --- a/ffi/glfw-input.c +++ b/ffi/glfw-input.c @@ -15,6 +15,13 @@ int KEY_E = GLFW_KEY_E; int KEY_I = GLFW_KEY_I; int KEY_L = GLFW_KEY_L; +int KEY_ENTER = GLFW_KEY_ENTER; +int KEY_SPACE = GLFW_KEY_SPACE; +int KEY_UP = GLFW_KEY_UP; +int KEY_LEFT = GLFW_KEY_LEFT; +int KEY_RIGHT = GLFW_KEY_RIGHT; +int KEY_DOWN = GLFW_KEY_DOWN; + // Calls function exported from SML void mouseMoveCallback(GLFWwindow *window, double xpos, double ypos) { mltonMouseMoveCallback((float)xpos, (float)ypos); diff --git a/ffi/glfw-input.sml b/ffi/glfw-input.sml index a0c979f..583df8e 100644 --- a/ffi/glfw-input.sml +++ b/ffi/glfw-input.sml @@ -46,4 +46,17 @@ struct _symbol "KEY_I" public : ( unit -> int ) * ( int -> unit ); val (KEY_L, _) = _symbol "KEY_L" public : ( unit -> int ) * ( int -> unit ); + + val (KEY_ENTER, _) = + _symbol "KEY_ENTER" public : ( unit -> int ) * ( int -> unit ); + val (KEY_SPACE, _) = + _symbol "KEY_SPACE" public : ( unit -> int ) * ( int -> unit ); + val (KEY_UP, _) = + _symbol "KEY_UP" public : ( unit -> int ) * ( int -> unit ); + val (KEY_LEFT, _) = + _symbol "KEY_LEFT" public : ( unit -> int ) * ( int -> unit ); + val (KEY_RIGHT, _) = + _symbol "KEY_RIGHT" public : ( unit -> int ) * ( int -> unit ); + val (KEY_DOWN, _) = + _symbol "KEY_DOWN" public : ( unit -> int ) * ( int -> unit ); end diff --git a/imperative-shell/input-callbacks.sml b/imperative-shell/input-callbacks.sml index 6eeaf64..e86671c 100644 --- a/imperative-shell/input-callbacks.sml +++ b/imperative-shell/input-callbacks.sml @@ -56,6 +56,36 @@ struct key = Input.KEY_E () andalso action = Input.PRESS () andalso mods = 0x002 then Mailbox.send (mailbox, KEY_CTRL_E) + else if + key = Input.KEY_UP () andalso action <> Input.RELEASE () + andalso mods = 0x0 + then + Mailbox.send (mailbox, ARROW_UP) + else if + key = Input.KEY_LEFT () andalso action <> Input.RELEASE () + andalso mods = 0x0 + then + Mailbox.send (mailbox, ARROW_LEFT) + else if + key = Input.KEY_RIGHT () andalso action <> Input.RELEASE () + andalso mods = 0x0 + then + Mailbox.send (mailbox, ARROW_RIGHT) + else if + key = Input.KEY_DOWN () andalso action <> Input.RELEASE () + andalso mods = 0x0 + then + Mailbox.send (mailbox, ARROW_DOWN) + else if + key = Input.KEY_ENTER () andalso action = Input.PRESS () + andalso mods = 0x0 + then + Mailbox.send (mailbox, KEY_ENTER) + else if + key = Input.KEY_SPACE () andalso action = Input.PRESS () + andalso mods = 0x0 + then + Mailbox.send (mailbox, KEY_SPACE) else ()