-
Notifications
You must be signed in to change notification settings - Fork 4
/
Part2-3.elm
43 lines (36 loc) · 1.07 KB
/
Part2-3.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import Graphics.Element exposing (..)
import Time
import Window
import Color exposing (..)
import Graphics.Collage exposing (..)
import Graphics.Element exposing (..)
import Keyboard
import Text exposing (monospace, fromString)
import Time exposing (..)
import Window
import Signal exposing ((<~), (~), foldp, sampleOn)
import Debug exposing (log, watch)
type H = H
(gameWidth,gameHeight) = (600,400)
(halfWidth,halfHeight) = (300,200)
pongGreen = rgb 60 100 60
textGreen = rgb 160 200 160
--
-- Collages
--
-- Exercise 2.2
-- Make another scene by adding more elements to it. Be creative!
-- Suggestions:
-- - Make different shapes: look at the `ngon` function
-- - Change colours; perhaps play with alpha
scene2 : String -> (Int,Int) -> Element
scene2 txt (w,h) =
container w h middle <|
collage gameWidth gameHeight
[ toForm <| show txt,
move (50,50) <| filled blue (oval 100 100),
move (-70,-70) <| filled yellow (rect 100 100),
H
]
main : Signal Element
main = (scene2 "hello") <~ Window.dimensions