Last active
May 25, 2016 17:24
-
-
Save bstro/4a1c5b56d0c2a69830362301e780ac8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(=>) = (,) | |
update : Msg -> Model -> (Model, Cmd Msg) | |
update msg model = | |
case msg of | |
NoOp | |
-> model | |
=> Cmd.none | |
Init res | |
-> ({ model | resolution = Just res }) | |
=> Cmd.none | |
Tick time | |
-> | |
let piece = model.activeBlock | |
in case piece of | |
Just v -> | |
if model.timeout < 1000 | |
then { model | timeout = model.timeout+time } => Cmd.none | |
else { model | timeout = 0.0 } => Task.perform never (\t -> Rotate t) (succeed v) | |
Nothing -> | |
model => Cmd.none | |
Rotate piece | |
-> | |
let rotated = rotatePiece piece | |
in { model | board = [Just rotated] } | |
=> Cmd.none |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment