Commit 5af770bd authored by Joris Guyonvarch's avatar Joris Guyonvarch

Updating elm version to 0.15

parent d5ec91d4
......@@ -2,14 +2,13 @@
"version": "2.2.1",
"summary": "",
"description": "",
"repository": "https://github.com/guyonvarch/catchvoid.git",
"license": "BSD3",
"source-directories": [
"src"
],
"source-directories": ["src"],
"exposed-modules": [],
"elm-version": "0.15.0 <= v < 0.16.0",
"dependencies": {
"elm-lang/core": "1.0.0 <= v < 2.0.0",
"evancz/elm-html": "1.0.0 <= v < 2.0.0"
},
"repository": "https://github.com/guyonvarch/catchvoid.git"
"elm-lang/core": "2.0.1 <= v < 3.0.0",
"evancz/elm-html": "3.0.0 <= v < 4.0.0"
}
}
module Input where
import Char (toCode)
import Keyboard (KeyCode, keysDown, arrows, isDown)
import Char exposing (toCode)
import Keyboard exposing (KeyCode, keysDown, arrows, isDown)
import Random
import Time (Time, fps)
import Signal (..)
import Time exposing (Time, fps)
import Signal exposing (..)
import Set exposing (Set)
import Model.Vec2 (Vec2)
import Model.Vec2 exposing (Vec2)
type alias Input =
{ dir : Vec2
, inputKeysDown : List KeyCode
, inputKeysDown : Set KeyCode
, delta : Time
}
......
......@@ -2,18 +2,18 @@ module Main where
import Signal
import Random
import Graphics.Element (Element)
import Html (Html)
import Graphics.Element exposing (Element)
import Html exposing (Html)
import Model.Game (Game, initialGame)
import Model.Vec2 (originVec)
import Model.Config (Config(White))
import Model.Game exposing (Game, initialGame)
import Model.Vec2 exposing (originVec)
import Model.Config exposing (Config(White))
import Update.Update (update)
import Update.Update exposing (update)
import Input (getInput)
import Input exposing (getInput)
import View.Page (pageView)
import View.Page exposing (pageView)
main : Signal Html
main = Signal.map pageView game
......
......@@ -3,7 +3,7 @@ module Model.Board
, boardDiagonal
) where
import Model.Vec2 (Vec2)
import Model.Vec2 exposing (Vec2)
initBoardSize : Vec2
initBoardSize =
......
......@@ -7,11 +7,11 @@ module Model.Cloud
import List
import Model.Point (..)
import Model.Player (..)
import Model.Config (..)
import Model.Point exposing (..)
import Model.Player exposing (..)
import Model.Config exposing (..)
import Utils.Geometry (distance)
import Utils.Geometry exposing (distance)
type alias Cloud =
{ points : Config -> List Point
......
......@@ -3,21 +3,23 @@ module Model.Game
, initialGame
) where
import Random (..)
import Keyboard (KeyCode)
import Time (Time)
import Random exposing (..)
import Keyboard exposing (KeyCode)
import Time exposing (Time)
import Set
import Set exposing (Set)
import Model.Player (..)
import Model.Cloud (..)
import Model.Vec2 (Vec2)
import Model.Config (..)
import Model.Round (Round)
import Model.Board (initBoardSize)
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 Game =
{ time : Float
, boardSize : Vec2
, keysDown : List KeyCode
, keysDown : Set KeyCode
, currentScore : Int
, player : Player
, cloud : Cloud
......@@ -29,7 +31,7 @@ initialGame : Seed -> Game
initialGame seed =
{ time = 0
, boardSize = initBoardSize
, keysDown = []
, keysDown = Set.empty
, currentScore = 0
, player = initPlayer
, cloud = initCloud
......
......@@ -5,8 +5,8 @@ module Model.Player
, playerSpeed
) where
import Model.Vec2 (..)
import Model.Config (..)
import Model.Vec2 exposing (..)
import Model.Config exposing (..)
type alias Player =
{ pos : Vec2
......
......@@ -7,8 +7,8 @@ module Model.Point
, pointAwayDist
) where
import Model.Vec2 (..)
import Model.Board (boardDiagonal)
import Model.Vec2 exposing (..)
import Model.Board exposing (boardDiagonal)
type alias Point =
{ initTime : Float
......
......@@ -4,7 +4,7 @@ module Model.Round
) where
import List
import Time (Time)
import Time exposing (Time)
type alias Round =
{ duration : Time
......
......@@ -3,17 +3,17 @@ module Update.CloudUpdate
) where
import List
import Random (..)
import Random exposing (..)
import Model.Vec2 (..)
import Model.Player (..)
import Model.Board (boardDiagonal)
import Model.Point (..)
import Model.Cloud (..)
import Model.Config (..)
import Model.Vec2 exposing (..)
import Model.Player exposing (..)
import Model.Board exposing (boardDiagonal)
import Model.Point exposing (..)
import Model.Cloud exposing (..)
import Model.Config exposing (..)
import Utils.Geometry (..)
import Utils.Physics (getMove, getWaveMove)
import Utils.Geometry exposing (..)
import Utils.Physics exposing (getMove, getWaveMove)
cloudUpdate : Float -> Vec2 -> Seed -> Player -> Cloud -> (Cloud, Int, Seed)
cloudUpdate time boardSize seed player {points, spawn, lastSpawn} =
......
......@@ -3,23 +3,25 @@ module Update.Update
) where
import List
import Keyboard (KeyCode)
import Char (fromCode, toCode)
import Keyboard exposing (KeyCode)
import Char exposing (fromCode, toCode)
import Maybe
import Set
import Set exposing (Set)
import Model.Player (..)
import Model.Vec2 (..)
import Model.Config (otherConfig)
import Model.Cloud (..)
import Model.Game (..)
import Model.Round (Round)
import Model.Player exposing (..)
import Model.Vec2 exposing (..)
import Model.Config exposing (otherConfig)
import Model.Cloud exposing (..)
import Model.Game exposing (..)
import Model.Round exposing (Round)
import Utils.Geometry (..)
import Utils.Physics (getNewPosAndSpeed)
import Utils.Geometry exposing (..)
import Utils.Physics exposing (getNewPosAndSpeed)
import Update.CloudUpdate (cloudUpdate)
import Update.CloudUpdate exposing (cloudUpdate)
import Input (Input)
import Input exposing (Input)
update : Input -> Game -> Game
update input game =
......@@ -54,7 +56,7 @@ playerStep dt boardSize dir newKey player =
, config = newConfig
}
newKeyCode : List KeyCode -> List KeyCode -> KeyCode -> Bool
newKeyCode : Set KeyCode -> Set KeyCode -> KeyCode -> Bool
newKeyCode lastKeyCodes newKeyCodes keyCode =
let contains = not << List.isEmpty << List.filter (\kc -> kc == keyCode)
let contains = not << List.isEmpty << List.filter (\kc -> kc == keyCode) << Set.toList
in not (contains lastKeyCodes) && (contains newKeyCodes)
......@@ -4,7 +4,7 @@ module Utils.Geometry
, inBoard
) where
import Model.Vec2 (..)
import Model.Vec2 exposing (..)
polarToCartesian : Float -> Float -> Vec2
polarToCartesian angle dist =
......
......@@ -4,7 +4,7 @@ module Utils.Physics
, getWaveMove
) where
import Model.Vec2 (..)
import Model.Vec2 exposing (..)
getNewPosAndSpeed : Float -> Vec2 -> (Float -> Float) -> (Vec2, Vec2) -> (Vec2, Vec2)
getNewPosAndSpeed dt dir computeSpeed (pos, speed) =
......
......@@ -4,21 +4,21 @@ module View.Game
import List
import Graphics.Collage (..)
import Graphics.Element (Element)
import Color (..)
import Text (..)
import Graphics.Collage exposing (..)
import Graphics.Element exposing (Element)
import Color exposing (..)
import Text exposing (..)
import Text
import Time (Time)
import Time exposing (Time)
import Model.Vec2 (Vec2)
import Model.Player (..)
import Model.Game (Game)
import Model.Point (..)
import Model.Config (..)
import Model.Round (..)
import Model.Vec2 exposing (Vec2)
import Model.Player exposing (..)
import Model.Game exposing (Game)
import Model.Point exposing (..)
import Model.Config exposing (..)
import Model.Round exposing (..)
import View.Round (roundView)
import View.Round exposing (roundView)
gameView : Game -> Element
gameView game =
......@@ -78,11 +78,13 @@ scoreForm boardSize currentRoundTime rounds score =
{ x = 0.0
, y = boardSize.y / 2 - 35
}
in if currentRoundTime < 5000 && (not (List.isEmpty rounds))
in if currentRoundTime < 5000
then
List.head rounds
|> roundView
|> textForm scorePos
case List.head rounds of
Just round ->
textForm scorePos (roundView round)
Nothing ->
textForm scorePos (toString score)
else
textForm scorePos (toString score)
......@@ -93,9 +95,8 @@ textForm pos content =
|> typeface ["calibri", "arial"]
|> Text.color textColor
|> bold
|> centered
in textElement
|> toForm
|> text
|> move (pos.x, pos.y)
textColor : Color
......
......@@ -3,18 +3,18 @@ module View.Page
) where
import List
import String (append)
import String exposing (append)
import Html (..)
import Html.Attributes (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Attributes as A
import Json.Encode (string)
import Json.Encode exposing (string)
import Model.Game (Game)
import Model.Round (..)
import Model.Game exposing (Game)
import Model.Round exposing (..)
import View.Game (gameView)
import View.Round (roundView)
import View.Game exposing (gameView)
import View.Round exposing (roundView)
pageView : Game -> Html
pageView game =
......
......@@ -2,9 +2,9 @@ module View.Round
( roundView
) where
import Model.Round (..)
import Model.Round exposing (..)
import View.Time (timeView)
import View.Time exposing (timeView)
roundView : Round -> String
roundView round =
......
......@@ -2,7 +2,7 @@ module View.Time
( timeView
) where
import Time (Time)
import Time exposing (Time)
timeView : Time -> String
timeView time =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment