scaffolding in preparation for implementing undo
This commit is contained in:
@@ -8,10 +8,8 @@ struct
|
||||
|
||||
fun mouseClickCallback mailbox (button, action) =
|
||||
if button = Input.LEFT_MOUSE_BUTTON () then
|
||||
if action = Input.MOUSE_PRESSED () then
|
||||
Mailbox.send (mailbox, MOUSE_LEFT_CLICK)
|
||||
else
|
||||
Mailbox.send (mailbox, MOUSE_LEFT_RELEASE)
|
||||
if action = Input.PRESS () then Mailbox.send (mailbox, MOUSE_LEFT_CLICK)
|
||||
else Mailbox.send (mailbox, MOUSE_LEFT_RELEASE)
|
||||
else
|
||||
()
|
||||
|
||||
@@ -20,6 +18,13 @@ struct
|
||||
in Mailbox.send (mailbox, RESIZE_WINDOW {width = width, height = height})
|
||||
end
|
||||
|
||||
fun keyActionCallback mailbox (key, scancode, action, mods) =
|
||||
if
|
||||
key = Input.KEY_Z () andalso action <> Input.RELEASE ()
|
||||
andalso mods = 0x0002
|
||||
then Mailbox.send (mailbox, UNDO_ACTION)
|
||||
else ()
|
||||
|
||||
fun registerCallbacks (window, inputMailbox) =
|
||||
let
|
||||
val mouseMoveCallback = mouseMoveCallback inputMailbox
|
||||
@@ -33,6 +38,10 @@ struct
|
||||
val resizeCallback = framebufferSizeCallback inputMailbox
|
||||
val _ = Input.exportFramebufferSizeCallback resizeCallback
|
||||
val _ = Input.setFramebufferSizeCallback window
|
||||
|
||||
val keyCallback = keyActionCallback inputMailbox
|
||||
val _ = Input.exportKeyCallback keyCallback
|
||||
val _ = Input.setKeyCallback window
|
||||
in
|
||||
()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user