aboutsummaryrefslogtreecommitdiff
path: root/src/View/Game.elm
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-03-07 18:46:47 +0100
committerJoris Guyonvarch2015-03-07 18:46:47 +0100
commit6c1f5e10631a3f66f4c85a45b6f28ffd366105c5 (patch)
tree624d833aa62ad8ce5ed172144ff69a2846d55154 /src/View/Game.elm
parentae14beca0452b59ead64b8cdd6544824d59a55dc (diff)
downloadcatchvoid-6c1f5e10631a3f66f4c85a45b6f28ffd366105c5.tar.gz
catchvoid-6c1f5e10631a3f66f4c85a45b6f28ffd366105c5.tar.bz2
catchvoid-6c1f5e10631a3f66f4c85a45b6f28ffd366105c5.zip
Show best score in html layout
Diffstat (limited to 'src/View/Game.elm')
-rw-r--r--src/View/Game.elm29
1 files changed, 9 insertions, 20 deletions
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