From 8714c3befcf3f9923cf72e8d992ba6d963c0e6e7 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 4 Sep 2016 15:52:17 +0200 Subject: Upgrade to elm 0.17.1 --- src/Main.elm | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'src/Main.elm') diff --git a/src/Main.elm b/src/Main.elm index d257b81..c1bebf5 100644 --- a/src/Main.elm +++ b/src/Main.elm @@ -1,24 +1,28 @@ -module Main where - -import Random -import Html exposing (Html) - -import Model.Game exposing (Game, initialGame) - -import Update.Update exposing (update) - -import Input exposing (getInput) - -import View.Game exposing (renderGame) - -main : Signal Html -main = Signal.map renderGame game - -game : Signal Game -game = - Signal.foldp - update - (initialGame (Random.initialSeed initialTime)) - getInput - -port initialTime : Int +module Main exposing + ( main + ) + +import Html.App exposing (programWithFlags) +import Time +import Keyboard +import Keyboard.Extra as Keyboard + +import Model exposing (init) +import Msg +import Update exposing (update) +import View exposing (view) + +main : Program Float +main = + programWithFlags + { init = init + , update = update + , subscriptions = (\model -> + Sub.batch + [ Time.every 40 Msg.Time + , Sub.map Msg.Keyboard Keyboard.subscriptions + , Keyboard.downs (\keycode -> if keycode == 69 then Msg.Transform else Msg.NoOp) + ] + ) + , view = view + } -- cgit v1.2.3