2024-07-30 17:10:48 +01:00
|
|
|
structure InputCallbacks =
|
|
|
|
|
struct
|
|
|
|
|
open CML
|
2024-07-30 19:04:36 +01:00
|
|
|
open InputMessage
|
2024-07-30 17:10:48 +01:00
|
|
|
|
|
|
|
|
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
|