From 6c1f5e10631a3f66f4c85a45b6f28ffd366105c5 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Sat, 7 Mar 2015 18:46:47 +0100 Subject: Show best score in html layout --- src/View/Game.elm | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'src/View/Game.elm') diff --git a/src/View/Game.elm b/src/View/Game.elm index 25b519c..8e76b48 100644 --- a/src/View/Game.elm +++ b/src/View/Game.elm @@ -18,15 +18,15 @@ import Model.Board (boardSize) import Model.Config (..) gameView : Game -> Element -gameView {time, score, player, cloud, bestScore} = - let whitePointForms = List.map (pointForm time (configColor White)) (cloud.points White) - blackPointForms = List.map (pointForm time (configColor Black)) (cloud.points Black) - forms = boardForms - ++ playerForms player - ++ whitePointForms - ++ blackPointForms - ++ scoreForms score - ++ bestScoreForms bestScore +gameView game = + let whitePointForms = List.map (pointForm game.time (configColor White)) (game.cloud.points White) + blackPointForms = List.map (pointForm game.time (configColor Black)) (game.cloud.points Black) + forms = + boardForms + ++ playerForms game.player + ++ whitePointForms + ++ blackPointForms + ++ scoreForms game.currentScore in collage (truncate boardSize.x) (truncate boardSize.y) forms boardForms : List Form @@ -72,17 +72,6 @@ scoreForms score = scorePos = { x = 0.0, y = boardSize.y / 2 - 30 } in [textForm text scorePos centered] -bestScoreForms : Int -> List Form -bestScoreForms bestScore = - if(bestScore > 0) then - let text = "Record: " ++ (toString bestScore) - pos = - { x = -boardSize.x / 2 + 100 - , y = -boardSize.y / 2 + 30 - } - in [textForm text pos leftAligned] - else [] - textForm : String -> Vec2 -> (Text -> Element) -> Form textForm content pos alignment = let textElement = fromString content -- cgit v1.2.3