aboutsummaryrefslogtreecommitdiff
path: root/src/Model.elm
diff options
context:
space:
mode:
authorJoris2016-09-04 15:52:17 +0200
committerJoris2016-09-04 15:53:32 +0200
commit8714c3befcf3f9923cf72e8d992ba6d963c0e6e7 (patch)
treee5ab35a918a95cbfee2f90dc34f3fe57fac42593 /src/Model.elm
parentcda08750ac7cdd83e73c1110800bea39928ffed9 (diff)
Upgrade to elm 0.17.1
Diffstat (limited to 'src/Model.elm')
-rw-r--r--src/Model.elm50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/Model.elm b/src/Model.elm
new file mode 100644
index 0000000..7e91e87
--- /dev/null
+++ b/src/Model.elm
@@ -0,0 +1,50 @@
+module Model exposing
+ ( Model
+ , init
+ )
+
+import Random.Pcg as Random exposing (Seed)
+import Char exposing (KeyCode)
+import Time exposing (Time)
+import Set
+import Set exposing (Set)
+import Platform.Cmd
+import Keyboard.Extra as Keyboard
+
+import Msg exposing (Msg)
+import Model.Player exposing (..)
+import Model.Cloud exposing (..)
+import Model.Vec2 exposing (Vec2)
+import Model.Config exposing (..)
+import Model.Round exposing (Round)
+import Model.Board exposing (initBoardSize)
+
+type alias Model =
+ { time : Time
+ , elapsedTime : Float
+ , boardSize : Vec2
+ , currentScore : Int
+ , player : Player
+ , cloud : Cloud
+ , rounds : List Round
+ , seed : Seed
+ , keyboard : Keyboard.Model
+ , transform : Bool
+ }
+
+init : Time -> (Model, Cmd Msg)
+init time =
+ let (keyboard, keyboardCmd) = Keyboard.init
+ in ( { time = time
+ , elapsedTime = 0
+ , boardSize = initBoardSize
+ , currentScore = 0
+ , player = initPlayer
+ , cloud = initCloud
+ , rounds = []
+ , seed = Random.initialSeed (round time)
+ , keyboard = keyboard
+ , transform = False
+ }
+ , Cmd.map Msg.Keyboard keyboardCmd
+ )