aztecs-transform 0.3.0 → 0.3.1
raw patch · 2 files changed
+10/−12 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Aztecs.Transform: Transform :: t -> s -> r -> Transform t s r
+ Aztecs.Transform: Transform :: !t -> !s -> !r -> Transform t s r
- Aztecs.Transform: [transformRotation] :: Transform t s r -> r
+ Aztecs.Transform: [transformRotation] :: Transform t s r -> !r
- Aztecs.Transform: [transformScale] :: Transform t s r -> s
+ Aztecs.Transform: [transformScale] :: Transform t s r -> !s
- Aztecs.Transform: [transformTranslation] :: Transform t s r -> t
+ Aztecs.Transform: [transformTranslation] :: Transform t s r -> !t
Files
- aztecs-transform.cabal +1/−1
- src/Aztecs/Transform.hs +9/−11
aztecs-transform.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: aztecs-transform-version: 0.3.0+version: 0.3.1 license: BSD-3-Clause license-file: LICENSE maintainer: matt@hunzinger.me
src/Aztecs/Transform.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE BangPatterns #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -25,8 +26,7 @@ GlobalTransform (..), transform, Size (..), - - module Linear + module Linear, ) where @@ -43,9 +43,7 @@ newtype GlobalTransform t s r = GlobalTransform {unGlobalTransform :: Transform t s r} deriving (Show) -instance - (Monad m, Typeable t, Typeable s, Typeable r) => - Component m (GlobalTransform t s r) +instance (Monad m, Typeable t, Typeable s, Typeable r) => Component m (GlobalTransform t s r) type Size2D = Size (V2 Float) @@ -57,9 +55,9 @@ type Transform2D = Transform (V2 Int) (V2 Float) Float data Transform t s r = Transform - { transformTranslation :: t, - transformScale :: s, - transformRotation :: r + { transformTranslation :: !t, + transformScale :: !s, + transformRotation :: !r } deriving (Show) @@ -79,7 +77,7 @@ propagateToChildren e globalT componentOnChange e _ newLocalT = do - globalT <- computeGlobalTransform e newLocalT + !globalT <- computeGlobalTransform e newLocalT insertUntracked e . bundle $ GlobalTransform @t @s @r globalT propagateToChildren e globalT @@ -100,11 +98,11 @@ where propagateToChild :: EntityID -> Access m () propagateToChild childE = do - maybeLocalT <- lookup @_ @(Transform t s r) childE + !maybeLocalT <- lookup @_ @(Transform t s r) childE case maybeLocalT of Nothing -> return () Just localT -> do - let childGlobal = localT <> parentGlobal + let !childGlobal = localT <> parentGlobal insertUntracked childE . bundle $ GlobalTransform @t @s @r childGlobal propagateToChildren childE childGlobal