aboutsummaryrefslogtreecommitdiff
path: root/src/Update/Update.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/Update/Update.elm')
-rw-r--r--src/Update/Update.elm30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/Update/Update.elm b/src/Update/Update.elm
index 2be00b0..97cf6e3 100644
--- a/src/Update/Update.elm
+++ b/src/Update/Update.elm
@@ -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)