Gleam 0.1.0.2 → 0.1.1.0
raw patch · 5 files changed
+17/−5 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- InputEvent: EventMotion :: Point -> Point -> InputEvent
+ InputEvent: EventMouse :: Point -> Point -> InputEvent
Files
- Gleam.cabal +1/−1
- src/Color.hs +1/−1
- src/Handler.hs +1/−1
- src/InputEvent.hs +1/−1
- src/Render.hs +13/−1
Gleam.cabal view
@@ -1,5 +1,5 @@ name: Gleam-version: 0.1.0.2+version: 0.1.1.0 cabal-version: >=1.10 license: BSD3 license-file: LICENSE
src/Color.hs view
@@ -41,5 +41,5 @@ Violet -> "#EE82EE" Azure -> "#007FFF" Chartreuse -> "#7FFF00"- Orange -> "ffa500"+ Orange -> "#FFA500" (RGBA string) -> string
src/Handler.hs view
@@ -133,7 +133,7 @@ convertMouse pos state = (EventKey (Mouse pos) state) convertMouseMove :: Point -> Point -> InputEvent-convertMouseMove (x, y) (nx, ny) = (EventMotion ((x - nx), (y - ny)) (nx, ny))+convertMouseMove (x, y) (nx, ny) = (EventMouse ((x - nx), (y - ny)) (nx, ny)) convertKeyCode :: UI.KeyCode -> KeyState -> InputEvent convertKeyCode code state
src/InputEvent.hs view
@@ -13,7 +13,7 @@ -- | A key or mouse button event = EventKey Key KeyState -- | A mouse motion event- | EventMotion Point Point+ | EventMouse Point Point deriving (Eq, Show) -- | A key.
src/Render.hs view
@@ -45,7 +45,9 @@ return () drawPicture (Rectangle width height) canvas = do- canvas # UI.fillRect (0 - (width / 2), 0 - (height / 2)) width height+ canvas # UI.beginPath+ canvas # drawRectangle (0 - (width / 2), 0 - (height / 2)) width height+ canvas # UI.fill return () drawPicture (Stroke color size picture) canvas = do@@ -54,6 +56,7 @@ canvas # set' UI.lineWidth size canvas # drawPicture picture canvas # restoreDrawState+ canvas # UI.stroke return () drawPicture (Text string font fontSize) canvas = do@@ -158,6 +161,15 @@ "%1.getContext('2d').drawImage(%2,%3,%4,%5,%6)" canvas image+ x+ y+ width+ height++drawRectangle :: Vector -> Double -> Double -> UI.Canvas -> UI ()+drawRectangle (x, y) width height canvas = UI.runFunction $ ffi+ "%1.getContext('2d').rect(%2,%3,%4,%5)"+ canvas x y width