add callbacks for mouse movement and mouse clicking

This commit is contained in:
2024-07-30 17:10:48 +01:00
parent 75b82fd888
commit e97768b18a
12 changed files with 102 additions and 49 deletions

View File

@@ -0,0 +1,17 @@
structure InputCallbacks =
struct
open CML
open Msg
fun mouseMoveCallback mailbox (x, y) =
Mailbox.send (mailbox, (MOUSE_MOVE {x = x, y = y}))
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)
else
()
end