add CHAR_EVENT message type (next is to handle hjkl navigation)

This commit is contained in:
2024-10-17 01:38:31 +01:00
parent ce23e50c8d
commit c77777cc09
4 changed files with 16 additions and 4 deletions

View File

@@ -6,13 +6,12 @@ struct
fun frameBufferSizeCallback inputMailbox (width, height) =
Mailbox.send (inputMailbox, RESIZE_EVENT (width, height))
fun charCallback word =
fun charCallback inputMailbox word =
let
val word = Word32.toInt word
val chr = Char.chr word
val s = Char.toString chr ^ "\n"
in
print s
Mailbox.send (inputMailbox, CHAR_EVENT chr)
end
fun registerCallbacks (inputMailbox, window) =
@@ -21,6 +20,7 @@ struct
val () = Input.exportFramebufferSizeCallback resizeCallback
val () = Input.setFramebufferSizeCallback window
val charCallback = charCallback inputMailbox
val () = Input.exportCharCallback charCallback
val () = Input.setCharCallback window
in