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
44
45
46
47
48
49
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
)
|