on 63243ca help sign in
elk/libraries/Mouse.elm
41 lines 871 B history raw
2module Mouse where
4{-| Library for working with mouse input.
6# Position
7@docs position, x, y
9# Button Status
10@docs isDown, clicks, isClicked
12-}
14import Signal (Signal)
15import Native.Mouse
17{-| The current mouse position. -}
18position : Signal (Int,Int)
19position = Native.Mouse.position
21{-| The current x-coordinate of the mouse. -}
22x : Signal Int
23x = Native.Mouse.x
25{-| The current y-coordinate of the mouse. -}
26y : Signal Int
27y = Native.Mouse.y
29{-| The current state of the left mouse-button.
30True when the button is down, and false otherwise. -}
31isDown : Signal Bool
32isDown = Native.Mouse.isDown
34{-| True immediately after the left mouse-button has been clicked,
35and false otherwise. -}
36isClicked : Signal Bool
37isClicked = Native.Mouse.isClicked
39{-| Always equal to unit. Event triggers on every mouse click. -}
40clicks : Signal ()
41clicks = Native.Mouse.clicks