packages feed

Hipmunk 0.1 → 0.2

raw patch · 10 files changed

+30/−12 lines, 10 filessetup-changed

Files

Hipmunk.cabal view
@@ -3,8 +3,8 @@ Tested-With:   GHC Category:      Physics, Game Name:          Hipmunk-Version:       0.1-Stability:     beta+Version:       0.2+Stability:     provisional License:       OtherLicense License-File:  LICENSE Copyright:     (c) 2008 Felipe A. Lessa@@ -21,6 +21,7 @@       .       Licensed under the MIT license (like Chipmunk itself). Extra-Source-Files:+      NEWS,       chipmunk/chipmunk.h,       chipmunk/cpArbiter.h,       chipmunk/cpArray.h,
+ NEWS view
@@ -0,0 +1,9 @@+Version 0.2+===========+ - Fix a subtle bug within Space that would keep some ForeignPtr's+   alive longer than needed, thus leaking memory.+++Version 0.1+===========+ - Initial public release.
Physics/Hipmunk.hs view
@@ -5,7 +5,7 @@ -- License     :  MIT (see LICENSE) -- -- Maintainer  :  felipe.lessa@gmail.com--- Stability   :  beta+-- Stability   :  provisional -- Portability :  portable (needs FFI) -- -- This module re-exports all other Hipmunk modules. It is
Physics/Hipmunk/Body.hsc view
@@ -5,7 +5,7 @@ -- License     :  MIT (see LICENSE) -- -- Maintainer  :  felipe.lessa@gmail.com--- Stability   :  beta+-- Stability   :  provisional -- Portability :  portable (needs FFI) -- -- Rigid bodies and their properties.
Physics/Hipmunk/Common.hsc view
@@ -21,7 +21,7 @@ -- License     :  MIT (see LICENSE) -- -- Maintainer  :  felipe.lessa@gmail.com--- Stability   :  beta+-- Stability   :  provisional -- Portability :  portable (needs FFI) -- -- Functionality used by various modules and routines for
Physics/Hipmunk/Internal.hsc view
@@ -5,7 +5,7 @@ -- License     :  MIT (see LICENSE) -- -- Maintainer  :  felipe.lessa@gmail.com--- Stability   :  beta+-- Stability   :  provisional -- Portability :  portable (needs FFI) -- -----------------------------------------------------------------------------
Physics/Hipmunk/Joint.hsc view
@@ -5,7 +5,7 @@ -- License     :  MIT (see LICENSE) -- -- Maintainer  :  felipe.lessa@gmail.com--- Stability   :  beta+-- Stability   :  provisional -- Portability :  portable (needs FFI) -- -- Joints that constrain bodies.
Physics/Hipmunk/Shape.hsc view
@@ -5,7 +5,7 @@ -- License     :  MIT (see LICENSE) -- -- Maintainer  :  felipe.lessa@gmail.com--- Stability   :  beta+-- Stability   :  provisional -- Portability :  portable (needs FFI) -- -- Shapes used for collisions, their properties and some useful
Physics/Hipmunk/Space.hsc view
@@ -5,7 +5,7 @@ -- License     :  MIT (see LICENSE) -- -- Maintainer  :  felipe.lessa@gmail.com--- Stability   :  beta+-- Stability   :  provisional -- Portability :  portable (needs FFI) -- -- The space, where the simulation happens and the various entities@@ -178,7 +178,7 @@         in withForeignPtr sp $ \sp_ptr ->            withForeignPtr new $ \new_ptr -> do              add sp_ptr new_ptr-             modifyIORef entities (M.insert key val)+             modifyIORef' entities (M.insert key val)  spaceRemoveHelper :: (a -> ForeignPtr b)                   -> (SpacePtr -> Ptr b -> IO ())@@ -187,10 +187,18 @@     \(P sp entities _) old_c -> do       let old  = get old_c           key  = unsafeForeignPtrToPtr $ castForeignPtr old-      modifyIORef entities (M.delete key)+      modifyIORef' entities (M.delete key)       withForeignPtr sp $ \sp_ptr ->         withForeignPtr old $ \old_ptr ->           remove sp_ptr old_ptr++-- | Strict version of modifyIORef (otherwise the thunks+--   will keep referencing removed entities).+modifyIORef' :: IORef a -> (a -> a) -> IO ()+modifyIORef' var f = do+  old <- readIORef var+  let new = f old+  new `seq` writeIORef var new  instance Entity Body where     spaceAdd    = spaceAddHelper    unB cpSpaceAddBody (const Nothing)
Setup.lhs view
@@ -1,3 +1,3 @@-#!runhaskell+#!/usr/bin/runhaskell > import Distribution.Simple > main = defaultMain