scaffolding for arrow-movement functionality
This commit is contained in:
@@ -10,6 +10,11 @@ int KEY_ESC = GLFW_KEY_ESCAPE;
|
||||
int KEY_ENTER = GLFW_KEY_ENTER;
|
||||
int KEY_BACKSPACE = GLFW_KEY_BACKSPACE;
|
||||
|
||||
int KEY_ARROW_LEFT = GLFW_KEY_LEFT;
|
||||
int KEY_ARROW_RIGHT = GLFW_KEY_RIGHT;
|
||||
int KEY_ARROW_UP = GLFW_KEY_UP;
|
||||
int KEY_ARROW_DOWN = GLFW_KEY_DOWN;
|
||||
|
||||
void framebufferSizeCallback(GLFWwindow* window, int width, int height) {
|
||||
glViewport(0, 0, width, height);
|
||||
mltonFramebufferSizeCallback(width, height);
|
||||
|
||||
@@ -39,4 +39,17 @@ struct
|
||||
val (KEY_BACKSPACE, _) =
|
||||
_symbol "KEY_BACKSPACE" public : ( unit -> int ) * ( int -> unit );
|
||||
val KEY_BACKSPACE = KEY_BACKSPACE ()
|
||||
|
||||
val (KEY_ARROW_LEFT, _) =
|
||||
_symbol "KEY_ARROW_LEFT" public : ( unit -> int ) * ( int -> unit );
|
||||
val KEY_ARROW_LEFT = KEY_ARROW_LEFT ()
|
||||
val (KEY_ARROW_UP, _) =
|
||||
_symbol "KEY_ARROW_UP" public : ( unit -> int ) * ( int -> unit );
|
||||
val KEY_ARROW_UP = KEY_ARROW_UP ()
|
||||
val (KEY_ARROW_RIGHT, _) =
|
||||
_symbol "KEY_ARROW_RIGHT" public : ( unit -> int ) * ( int -> unit );
|
||||
val KEY_ARROW_RIGHT = KEY_ARROW_RIGHT ()
|
||||
val (KEY_ARROW_DOWN, _) =
|
||||
_symbol "KEY_ARROW_DOWN" public : ( unit -> int ) * ( int -> unit );
|
||||
val KEY_ARROW_DOWN = KEY_ARROW_DOWN ()
|
||||
end
|
||||
|
||||
@@ -7,4 +7,8 @@ struct
|
||||
| KEY_BACKSPACE
|
||||
| RESIZE_EVENT of int * int
|
||||
| WITH_SEARCH_LIST of int vector
|
||||
| ARROW_LEFT
|
||||
| ARROW_UP
|
||||
| ARROW_RIGHT
|
||||
| ARROW_DOWN
|
||||
end
|
||||
|
||||
@@ -29,6 +29,14 @@ struct
|
||||
Mailbox.send (inputMailbox, InputMsg.KEY_ENTER)
|
||||
else if key = KEY_BACKSPACE andalso action <> RELEASE andalso mods = 0 then
|
||||
Mailbox.send (inputMailbox, InputMsg.KEY_BACKSPACE)
|
||||
else if key = KEY_ARROW_LEFT andalso action <> RELEASE andalso mods = 0 then
|
||||
Mailbox.send (inputMailbox, InputMsg.ARROW_LEFT)
|
||||
else if key = KEY_ARROW_RIGHT andalso action <> RELEASE andalso mods = 0 then
|
||||
Mailbox.send (inputMailbox, InputMsg.ARROW_RIGHT)
|
||||
else if key = KEY_ARROW_UP andalso action <> RELEASE andalso mods = 0 then
|
||||
Mailbox.send (inputMailbox, InputMsg.ARROW_UP)
|
||||
else if key = KEY_ARROW_DOWN andalso action <> RELEASE andalso mods = 0 then
|
||||
Mailbox.send (inputMailbox, InputMsg.ARROW_DOWN)
|
||||
else
|
||||
()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user