on master help sign in
Merge pull request #156 from perplexes/docs
c575e4cEvan Czaplicki
libraries/Graphics/Collage.elm+6
@@ -46,6 +46,7 @@ defaultLine = {
46 miterLimit = 10
46 miterLimit = 10
47 }
47 }
48
48
49+-- default LineStyles
49solid : Color -> LineStyle
50solid : Color -> LineStyle
50solid clr = { defaultLine | color <- clr }
51solid clr = { defaultLine | color <- clr }
51dashed : Color -> LineStyle
52dashed : Color -> LineStyle
@@ -79,6 +80,11 @@ outlined style shape = form (FShape (Left style) shape)
79traced : LineStyle -> Path -> Form
80traced : LineStyle -> Path -> Form
80traced style path = form (FPath style path)
81traced style path = form (FPath style path)
81
82
83+-- Draw a sprite
84+-- w width
85+-- h height
86+-- pos (px,py) coordinates into the sprite map
87+-- src The location of the image
82sprite : Int -> Int -> (Int,Int) -> String -> Form
88sprite : Int -> Int -> (Int,Int) -> String -> Form
83sprite w h pos src = form (FImage w h pos src)
89sprite w h pos src = form (FImage w h pos src)
84
90
libraries/Json.elm+2−2
@@ -38,12 +38,12 @@ toJSString : Value -> JSString
38toJSString v = Native.toPrettyJSString "" v
38toJSString v = Native.toPrettyJSString "" v
39
39
40-- Parse a string representation of a proper JSON object into
40-- Parse a string representation of a proper JSON object into
41−-- its Elm's representation.
41+-- its Elm representation.
42fromString : String -> Maybe Value
42fromString : String -> Maybe Value
43fromString s = Native.fromJSString (JS.fromString s)
43fromString s = Native.fromJSString (JS.fromString s)
44
44
45-- Parse a JavaScript string representation of a proper JSON object into
45-- Parse a JavaScript string representation of a proper JSON object into
46−-- its Elm's representation.
46+-- its Elm representation.
47fromJSString : JSString -> Maybe Value
47fromJSString : JSString -> Maybe Value
48
48
49
49
libraries/Signal.elm+5−4
@@ -3,7 +3,7 @@
3-- working with time (e.g. setting FPS) and combining signals and time (e.g.
3-- working with time (e.g. setting FPS) and combining signals and time (e.g.
4-- delaying updates, getting timestamps) can be found in the
4-- delaying updates, getting timestamps) can be found in the
5-- [`Time`](/docs/Signal/Time.elm) library.
5-- [`Time`](/docs/Signal/Time.elm) library.
6−--
6+--
7-- Note: There are lift functions up to `lift8`.
7-- Note: There are lift functions up to `lift8`.
8module Signal where
8module Signal where
9
9
@@ -29,7 +29,7 @@ lift8 : (a -> b -> c -> d -> e -> f -> g -> h -> i) -> Signal a -> Signal b -> S
29
29
30-- Create a past-dependent signal. Each value given on the input signal will
30-- Create a past-dependent signal. Each value given on the input signal will
31-- be accumulated, producing a new output value.
31-- be accumulated, producing a new output value.
32−--
32+--
33-- For instance, `(foldp (\\t acc -> acc + 1) 0 (Time.every second))` increments every second.
33-- For instance, `(foldp (\\t acc -> acc + 1) 0 (Time.every second))` increments every second.
34foldp : (a -> b -> b) -> b -> Signal a -> Signal b
34foldp : (a -> b -> b) -> b -> Signal a -> Signal b
35
35
@@ -41,6 +41,7 @@ merge : Signal a -> Signal a -> Signal a
41-- signals update simultaneously.
41-- signals update simultaneously.
42merges : [Signal a] -> Signal a
42merges : [Signal a] -> Signal a
43
43
44+-- Combine many signals into one, with an array of results.
44combine : [Signal a] -> Signal [a]
45combine : [Signal a] -> Signal [a]
45combine = L.foldr (S.lift2 (::)) (S.constant [])
46combine = L.foldr (S.lift2 (::)) (S.constant [])
46
47
@@ -104,9 +105,9 @@ delay : Time -> Signal a -> Signal a
104
105
105-- Signal application. This takes two signals, holding a function and
106-- Signal application. This takes two signals, holding a function and
106-- a value. It applies the current function to the current value.
107-- a value. It applies the current function to the current value.
107−--
108+--
108-- So the following expressions are equivalent:
109-- So the following expressions are equivalent:
109−--
110+--
110-- scene <~ Mouse.x ~ Mouse.y
111-- scene <~ Mouse.x ~ Mouse.y
111-- lift2 scene Mouse.x Mouse.y
112-- lift2 scene Mouse.x Mouse.y
112(~) : Signal (a -> b) -> Signal a -> Signal b
113(~) : Signal (a -> b) -> Signal a -> Signal b
libraries/Time.elm+1−1
@@ -39,7 +39,7 @@ inHours t = t / hour
39fps : Number a -> Signal Time
39fps : Number a -> Signal Time
40
40
41-- Same as the fps function, but you can turn it on and off. Allows you
41-- Same as the fps function, but you can turn it on and off. Allows you
42−-- to do brief animations based on user input without major ineffeciencies.
42+-- to do brief animations based on user input without major inefficiencies.
43-- The first time delta after a pause is always zero, no matter how long
43-- The first time delta after a pause is always zero, no matter how long
44-- the pause was. This way summing the deltas will actually give the amount
44-- the pause was. This way summing the deltas will actually give the amount
45-- of time that the output signal has been running.
45-- of time that the output signal has been running.