Hipmunk 5.2.0.8 → 5.2.0.9
raw patch · 4 files changed
+21/−5 lines, 4 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Physics.Hipmunk.Constraint: setMaxBias :: CpFloat -> Constraint a -> IO ()
+ Physics.Hipmunk.Constraint: setMaxForce :: CpFloat -> Constraint a -> IO ()
Files
- Hipmunk.cabal +6/−1
- Physics/Hipmunk/Callbacks.hsc +1/−1
- Physics/Hipmunk/Constraint.hsc +8/−0
- Physics/Hipmunk/Space.hsc +6/−3
Hipmunk.cabal view
@@ -3,7 +3,7 @@ Tested-With: GHC Category: Physics, Game Name: Hipmunk-Version: 5.2.0.8+Version: 5.2.0.9 Stability: provisional License: OtherLicense License-File: LICENSE@@ -19,6 +19,11 @@ all of its functions. It is completely self-contained. Please see <http://hackage.haskell.org/package/HipmunkPlayground> for a demonstration of this library.+ .+ New in version 5.2.0.9:+ .+ * Added Physics.Hipmunk.Constraint.setMaxBias and setMaxForce.+ Thanks to Stephen Paul Weber. . New in version 5.2.0.6: .
Physics/Hipmunk/Callbacks.hsc view
@@ -74,7 +74,7 @@ import Data.IORef import qualified Data.Map as M import Foreign hiding (new)-import Foreign.C.Types (CInt)+import Foreign.C.Types (CInt(..)) #include "wrapper.h" import Physics.Hipmunk.Common
Physics/Hipmunk/Constraint.hsc view
@@ -18,6 +18,8 @@ newConstraint, redefineC, setBiasCoefC,+ setMaxBias,+ setMaxForce, -- ** Forgetting the phantom type -- $phantom Unknown,@@ -105,6 +107,12 @@ -- 'setConstraintBiasCoef', which initially is @0.1@ setBiasCoefC :: BiasCoef -> Constraint a -> IO () setBiasCoefC b (C c _ _) = withForeignPtr c $ flip #{poke cpConstraint, biasCoef} b++setMaxBias :: CpFloat -> Constraint a -> IO ()+setMaxBias b (C c _ _) = withForeignPtr c $ flip #{poke cpConstraint, maxBias} b++setMaxForce :: CpFloat -> Constraint a -> IO ()+setMaxForce b (C c _ _) = withForeignPtr c $ flip #{poke cpConstraint, maxForce} b -- $phantom -- These functions discard the phantom type of the constraint.
Physics/Hipmunk/Space.hsc view
@@ -62,7 +62,8 @@ import Data.IORef import Data.StateVar import Foreign hiding (new)-import Foreign.C.Types (CInt)+import qualified Foreign.ForeignPtr.Unsafe+import Foreign.C.Types (CInt(..)) #include "wrapper.h" import Physics.Hipmunk.Common@@ -171,7 +172,8 @@ spaceAddHelper get_ add toShape = \(P sp entities _) new_c -> let new = get_ new_c- key = unsafeForeignPtrToPtr $ castForeignPtr new+ key = Foreign.ForeignPtr.Unsafe.unsafeForeignPtrToPtr $+ castForeignPtr new val = case toShape new_c of Just shape -> Right shape Nothing -> Left (castForeignPtr new)@@ -186,7 +188,8 @@ spaceRemoveHelper get_ remove = \(P sp entities _) old_c -> do let old = get_ old_c- key = unsafeForeignPtrToPtr $ castForeignPtr old+ key = Foreign.ForeignPtr.Unsafe.unsafeForeignPtrToPtr $+ castForeignPtr old modifyIORef' entities (M.delete key) withForeignPtr sp $ \sp_ptr -> withForeignPtr old $ \old_ptr ->