diff options
author | Joris Guyonvarch | 2014-10-08 22:13:41 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2014-10-08 22:27:11 +0200 |
commit | d37a301ed39bac823e0f2223b8d229b417e128c7 (patch) | |
tree | e7e1155e8678bfb32908452993234078527d6664 /src/Display.elm | |
parent | 4521cdf1bb5725c9d497e5fb0c03943ad03a052f (diff) |
Adding a power to change the player color that reverse points to catch and points to avoid
Diffstat (limited to 'src/Display.elm')
-rw-r--r-- | src/Display.elm | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/Display.elm b/src/Display.elm index aa4ed51..c52b9e3 100644 --- a/src/Display.elm +++ b/src/Display.elm @@ -5,15 +5,16 @@ import Player (..) import Game (Game) import Point (..) import Board (boardSize) +import Config (..) display : Game -> Element display {time, score, player, cloud, bestScore} = - let greenPointForms = map (pointForm time greenPointColor) cloud.greenPoints - redPointForms = map (pointForm time redPointColor) cloud.redPoints + let whitePointForms = map (pointForm time (configColor White)) (cloud.points White) + blackPointForms = map (pointForm time (configColor Black)) (cloud.points Black) forms = boardForms ++ playerForms player - ++ greenPointForms - ++ redPointForms + ++ whitePointForms + ++ blackPointForms ++ scoreForms score ++ bestScoreForms bestScore in collage (truncate boardSize.x) (truncate boardSize.y) forms @@ -22,10 +23,12 @@ boardForms : [Form] boardForms = [filled boardColor (rect boardSize.x boardSize.y)] boardColor : Color -boardColor = rgb 17 17 17 +boardColor = rgb 103 123 244 playerForms : Player -> [Form] -playerForms player = [circleForm player.pos playerSize playerColor] +playerForms player = + let playerColor = configColor player.config + in [circleForm player.pos playerSize playerColor] playerColor : Color playerColor = rgb 224 224 224 @@ -35,11 +38,11 @@ pointForm time color point = let pos = pointMove point time in circleForm pos pointSize color -greenPointColor : Color -greenPointColor = rgb 34 85 34 - -redPointColor : Color -redPointColor = rgb 170 0 0 +configColor : Config -> Color +configColor config = + case config of + White -> rgb 240 240 240 + Black -> rgb 14 17 33 circleForm : Vec2 -> Float -> Color -> Form circleForm pos size color = @@ -64,15 +67,16 @@ bestScoreForms bestScore = if(bestScore > 0) then let text = "Record: " ++ (show bestScore) pos = - { x = boardSize.x / 2 - 65 + { x = -boardSize.x / 2 + 100 , y = -boardSize.y / 2 + 30 } - in [textForm text pos rightAligned] + in [textForm text pos leftAligned] else [] textForm : String -> Vec2 -> (Text -> Element) -> Form textForm content pos alignment = let textElement = toText content + |> Text.height 30 |> typeface ["calibri", "arial"] |> Text.color textColor |> bold @@ -82,4 +86,4 @@ textForm content pos alignment = |> move (pos.x, pos.y) textColor : Color -textColor = rgb 224 224 224 +textColor = rgb 14 17 33 |