{-# LINE 1 "src/Chiphunk/Low/Space.chs" #-}
module Chiphunk.Low.Space
( Space
, spaceIterations
, spaceGravity
, spaceDamping
, spaceIdleSpeedThreshold
, spaceSleepTimeThreshold
, spaceCollisionSlop
, spaceCollisionBias
, spaceCollisionPersistence
, spaceCurrentTimeStep
, spaceIsLocked
, spaceUserData
, spaceStaticBody
, spaceNew
, spaceFree
, spaceAddShape
, spaceAddBody
, spaceAddConstraint
, spaceRemoveShape
, spaceRemoveBody
, spaceRemoveConstraint
, spaceContainsShape
, spaceContainsBody
, spaceContainsConstraint
, spaceReindexShape
, spaceReindexShapesForBody
, spaceReindexStatic
, SpaceBodyIteratorFunc
, spaceEachBody
, SpaceShapeIteratorFunc
, spaceEachShape
, SpaceConstraintIteratorFunc
, spaceEachConstraint
, spaceStep
) where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Marshal.Utils as C2HSImp
import qualified Foreign.Ptr as C2HSImp
import Control.Exception.Safe
import Data.StateVar
import Foreign
import Chiphunk.Low.Vect
import Chiphunk.Low.Types
{-# LINE 45 "src/Chiphunk/Low/Space.chs" #-}
cpSpaceGetIterations :: (Space) -> IO ((Int))
cpSpaceGetIterations a1 =
let {a1' = id a1} in
cpSpaceGetIterations'_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 50 "src/Chiphunk/Low/Space.chs" #-}
cpSpaceSetIterations :: (Space) -> (Int) -> IO ()
cpSpaceSetIterations a1 a2 =
let {a1' = id a1} in
let {a2' = fromIntegral a2} in
cpSpaceSetIterations'_ a1' a2' >>
return ()
{-# LINE 52 "src/Chiphunk/Low/Space.chs" #-}
spaceIterations :: Space -> StateVar Int
spaceIterations = mkStateVar cpSpaceGetIterations cpSpaceSetIterations
w_cpSpaceGetGravity :: (Space) -> IO ((Vect))
w_cpSpaceGetGravity :: Space -> IO Vect
w_cpSpaceGetGravity Space
a1 =
let {a1' :: Space
a1' = Space -> Space
forall a. a -> a
id Space
a1} in
(Ptr Vect -> IO Vect) -> IO Vect
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Vect -> IO Vect) -> IO Vect)
-> (Ptr Vect -> IO Vect) -> IO Vect
forall a b. (a -> b) -> a -> b
$ \Ptr Vect
a2' ->
Space -> Ptr Vect -> IO ()
w_cpSpaceGetGravity'_ Space
a1' Ptr Vect
a2' IO () -> IO Vect -> IO Vect
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
Ptr Vect -> IO Vect
forall a. Storable a => Ptr a -> IO a
peek Ptr Vect
a2'IO Vect -> (Vect -> IO Vect) -> IO Vect
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Vect
a2'' ->
Vect -> IO Vect
forall (m :: * -> *) a. Monad m => a -> m a
return (Vect
a2'')
{-# LINE 59 "src/Chiphunk/Low/Space.chs" #-}
cpSpaceSetGravity :: (Space) -> (Vect) -> IO ()
cpSpaceSetGravity a1 a2 =
let {a1' = id a1} in
with a2 $ \a2' ->
cpSpaceSetGravity'_ a1' a2' >>
return ()
{-# LINE 61 "src/Chiphunk/Low/Space.chs" #-}
spaceGravity :: Space -> StateVar Vect
spaceGravity = mkStateVar w_cpSpaceGetGravity cpSpaceSetGravity
cpSpaceGetDamping :: (Space) -> IO ((Double))
cpSpaceGetDamping :: Space -> IO Double
cpSpaceGetDamping Space
a1 =
let {a1' :: Space
a1' = Space -> Space
forall a. a -> a
id Space
a1} in
Space -> IO CDouble
cpSpaceGetDamping'_ Space
a1' IO CDouble -> (CDouble -> IO Double) -> IO Double
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
res')
{-# LINE 69 "src/Chiphunk/Low/Space.chs" #-}
cpSpaceSetDamping :: (Space) -> (Double) -> IO ()
cpSpaceSetDamping a1 a2 =
let {a1' = id a1} in
let {a2' = realToFrac a2} in
cpSpaceSetDamping'_ a1' a2' >>
return ()
{-# LINE 71 "src/Chiphunk/Low/Space.chs" #-}
spaceDamping :: Space -> StateVar Double
spaceDamping = mkStateVar cpSpaceGetDamping cpSpaceSetDamping
cpSpaceGetIdleSpeedThreshold :: (Space) -> IO ((Double))
cpSpaceGetIdleSpeedThreshold :: Space -> IO Double
cpSpaceGetIdleSpeedThreshold Space
a1 =
let {a1' :: Space
a1' = Space -> Space
forall a. a -> a
id Space
a1} in
Space -> IO CDouble
cpSpaceGetIdleSpeedThreshold'_ Space
a1' IO CDouble -> (CDouble -> IO Double) -> IO Double
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
res')
{-# LINE 79 "src/Chiphunk/Low/Space.chs" #-}
cpSpaceSetIdleSpeedThreshold :: (Space) -> (Double) -> IO ()
cpSpaceSetIdleSpeedThreshold a1 a2 =
let {a1' = id a1} in
let {a2' = realToFrac a2} in
cpSpaceSetIdleSpeedThreshold'_ a1' a2' >>
return ()
{-# LINE 81 "src/Chiphunk/Low/Space.chs" #-}
spaceIdleSpeedThreshold :: Space -> StateVar Double
spaceIdleSpeedThreshold = mkStateVar cpSpaceGetIdleSpeedThreshold cpSpaceSetIdleSpeedThreshold
cpSpaceGetSleepTimeThreshold :: (Space) -> IO ((Double))
cpSpaceGetSleepTimeThreshold :: Space -> IO Double
cpSpaceGetSleepTimeThreshold Space
a1 =
let {a1' :: Space
a1' = Space -> Space
forall a. a -> a
id Space
a1} in
Space -> IO CDouble
cpSpaceGetSleepTimeThreshold'_ Space
a1' IO CDouble -> (CDouble -> IO Double) -> IO Double
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
res')
{-# LINE 88 "src/Chiphunk/Low/Space.chs" #-}
cpSpaceSetSleepTimeThreshold :: (Space) -> (Double) -> IO ()
cpSpaceSetSleepTimeThreshold a1 a2 =
let {a1' = id a1} in
let {a2' = realToFrac a2} in
cpSpaceSetSleepTimeThreshold'_ a1' a2' >>
return ()
{-# LINE 90 "src/Chiphunk/Low/Space.chs" #-}
spaceSleepTimeThreshold :: Space -> StateVar Double
spaceSleepTimeThreshold = mkStateVar cpSpaceGetSleepTimeThreshold cpSpaceSetSleepTimeThreshold
cpSpaceGetCollisionSlop :: (Space) -> IO ((Double))
cpSpaceGetCollisionSlop :: Space -> IO Double
cpSpaceGetCollisionSlop Space
a1 =
let {a1' :: Space
a1' = Space -> Space
forall a. a -> a
id Space
a1} in
Space -> IO CDouble
cpSpaceGetCollisionSlop'_ Space
a1' IO CDouble -> (CDouble -> IO Double) -> IO Double
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
res')
{-# LINE 97 "src/Chiphunk/Low/Space.chs" #-}
cpSpaceSetCollisionSlop :: (Space) -> (Double) -> IO ()
cpSpaceSetCollisionSlop a1 a2 =
let {a1' = id a1} in
let {a2' = realToFrac a2} in
cpSpaceSetCollisionSlop'_ a1' a2' >>
return ()
{-# LINE 99 "src/Chiphunk/Low/Space.chs" #-}
spaceCollisionSlop :: Space -> StateVar Double
spaceCollisionSlop = mkStateVar cpSpaceGetCollisionSlop cpSpaceSetCollisionSlop
cpSpaceGetCollisionBias :: (Space) -> IO ((Double))
cpSpaceGetCollisionBias :: Space -> IO Double
cpSpaceGetCollisionBias Space
a1 =
let {a1' :: Space
a1' = Space -> Space
forall a. a -> a
id Space
a1} in
Space -> IO CDouble
cpSpaceGetCollisionBias'_ Space
a1' IO CDouble -> (CDouble -> IO Double) -> IO Double
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
res')
{-# LINE 107 "src/Chiphunk/Low/Space.chs" #-}
cpSpaceSetCollisionBias :: (Space) -> (Double) -> IO ()
cpSpaceSetCollisionBias a1 a2 =
let {a1' = id a1} in
let {a2' = realToFrac a2} in
cpSpaceSetCollisionBias'_ a1' a2' >>
return ()
{-# LINE 109 "src/Chiphunk/Low/Space.chs" #-}
spaceCollisionBias :: Space -> StateVar Double
spaceCollisionBias :: Space -> StateVar Double
spaceCollisionBias = (Space -> IO Double)
-> (Space -> Double -> IO ()) -> Space -> StateVar Double
forall a b. (a -> IO b) -> (a -> b -> IO ()) -> a -> StateVar b
mkStateVar Space -> IO Double
cpSpaceGetCollisionBias Space -> Double -> IO ()
cpSpaceSetCollisionBias
cpSpaceGetCollisionPersistence :: (Space) -> IO ((Word32))
cpSpaceGetCollisionPersistence :: Space -> IO Word32
cpSpaceGetCollisionPersistence Space
a1 =
let {a1' :: Space
a1' = Space -> Space
forall a. a -> a
id Space
a1} in
Space -> IO CUInt
cpSpaceGetCollisionPersistence'_ Space
a1' IO CUInt -> (CUInt -> IO Word32) -> IO Word32
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CUInt
res ->
let {res' :: Word32
res' = CUInt -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
res} in
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32
res')
{-# LINE 127 "src/Chiphunk/Low/Space.chs" #-}
cpSpaceSetCollisionPersistence :: (Space) -> (Word32) -> IO ()
cpSpaceSetCollisionPersistence a1 a2 =
let {a1' = id a1} in
let {a2' = fromIntegral a2} in
cpSpaceSetCollisionPersistence'_ a1' a2' >>
return ()
{-# LINE 129 "src/Chiphunk/Low/Space.chs" #-}
spaceCollisionPersistence :: Space -> StateVar Word32
spaceCollisionPersistence = mkStateVar cpSpaceGetCollisionPersistence cpSpaceSetCollisionPersistence
cpSpaceGetCurrentTimeStep :: (Space) -> IO ((Double))
cpSpaceGetCurrentTimeStep :: Space -> IO Double
cpSpaceGetCurrentTimeStep Space
a1 =
let {a1' :: Space
a1' = Space -> Space
forall a. a -> a
id Space
a1} in
Space -> IO CDouble
cpSpaceGetCurrentTimeStep'_ Space
a1' IO CDouble -> (CDouble -> IO Double) -> IO Double
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
return (res')
{-# LINE 137 "src/Chiphunk/Low/Space.chs" #-}
spaceCurrentTimeStep :: Space -> GettableStateVar Double
spaceCurrentTimeStep = makeGettableStateVar . cpSpaceGetCurrentTimeStep
spaceIsLocked :: (Space) -> IO ((Bool))
spaceIsLocked :: Space -> IO Bool
spaceIsLocked Space
a1 =
let {a1' :: Space
a1' = Space -> Space
forall a. a -> a
id Space
a1} in
Space -> IO CUChar
spaceIsLocked'_ Space
a1' IO CUChar -> (CUChar -> IO Bool) -> IO Bool
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CUChar
res ->
let {res' :: Bool
res' = CUChar -> Bool
forall a. (Eq a, Num a) => a -> Bool
C2HSImp.toBool CUChar
res} in
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
res')
{-# LINE 147 "src/Chiphunk/Low/Space.chs" #-}
cpSpaceGetUserData :: (Space) -> IO ((DataPtr))
cpSpaceGetUserData a1 =
let {a1' = id a1} in
cpSpaceGetUserData'_ a1' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 149 "src/Chiphunk/Low/Space.chs" #-}
cpSpaceSetUserData :: (Space) -> (DataPtr) -> IO ()
cpSpaceSetUserData a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
cpSpaceSetUserData'_ a1' a2' >>
return ()
{-# LINE 151 "src/Chiphunk/Low/Space.chs" #-}
spaceUserData :: Space -> StateVar DataPtr
spaceUserData = mkStateVar cpSpaceGetUserData cpSpaceSetUserData
cpSpaceGetStaticBody :: (Space) -> IO ((Body))
cpSpaceGetStaticBody :: Space -> IO Body
cpSpaceGetStaticBody Space
a1 =
let {a1' :: Space
a1' = Space -> Space
forall a. a -> a
id Space
a1} in
Space -> IO Body
cpSpaceGetStaticBody'_ Space
a1' IO Body -> (Body -> IO Body) -> IO Body
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Body
res ->
let {res' :: Body
res' = Body -> Body
forall a. a -> a
id Body
res} in
Body -> IO Body
forall (m :: * -> *) a. Monad m => a -> m a
return (Body
res')
{-# LINE 159 "src/Chiphunk/Low/Space.chs" #-}
spaceStaticBody :: Space -> GettableStateVar Body
spaceStaticBody = makeGettableStateVar . cpSpaceGetStaticBody
spaceNew :: IO ((Space))
spaceNew :: IO Space
spaceNew =
IO Space
spaceNew'_ IO Space -> (Space -> IO Space) -> IO Space
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Space
res ->
let {res' :: Space
res' = Space -> Space
forall a. a -> a
id Space
res} in
Space -> IO Space
forall (m :: * -> *) a. Monad m => a -> m a
return (Space
res')
{-# LINE 169 "src/Chiphunk/Low/Space.chs" #-}
spaceFree :: (Space) -> IO ()
spaceFree a1 =
let {a1' = id a1} in
spaceFree'_ a1' >>
return ()
{-# LINE 172 "src/Chiphunk/Low/Space.chs" #-}
spaceAddShape :: (Space) -> (Shape) -> IO ()
spaceAddShape a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
spaceAddShape'_ a1' a2' >>
return ()
{-# LINE 176 "src/Chiphunk/Low/Space.chs" #-}
spaceAddBody :: (Space) -> (Body) -> IO ()
spaceAddBody a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
spaceAddBody'_ a1' a2' >>
return ()
{-# LINE 179 "src/Chiphunk/Low/Space.chs" #-}
spaceAddConstraint :: (Space) -> (Constraint) -> IO ()
spaceAddConstraint a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
spaceAddConstraint'_ a1' a2' >>
return ()
{-# LINE 182 "src/Chiphunk/Low/Space.chs" #-}
spaceRemoveShape :: (Space) -> (Shape) -> IO ()
spaceRemoveShape a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
spaceRemoveShape'_ a1' a2' >>
return ()
{-# LINE 185 "src/Chiphunk/Low/Space.chs" #-}
spaceRemoveBody :: (Space) -> (Body) -> IO ()
spaceRemoveBody a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
spaceRemoveBody'_ a1' a2' >>
return ()
{-# LINE 189 "src/Chiphunk/Low/Space.chs" #-}
spaceRemoveConstraint :: (Space) -> (Constraint) -> IO ()
spaceRemoveConstraint a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
spaceRemoveConstraint'_ a1' a2' >>
return ()
{-# LINE 193 "src/Chiphunk/Low/Space.chs" #-}
spaceContainsShape :: (Space) -> (Shape) -> IO ((Bool))
spaceContainsShape a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
spaceContainsShape'_ a1' a2' >>= \res ->
let {res' = C2HSImp.toBool res} in
return (res')
{-# LINE 197 "src/Chiphunk/Low/Space.chs" #-}
spaceContainsBody :: (Space) -> (Body) -> IO ((Bool))
spaceContainsBody a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
spaceContainsBody'_ a1' a2' >>= \res ->
let {res' = C2HSImp.toBool res} in
return (res')
{-# LINE 200 "src/Chiphunk/Low/Space.chs" #-}
spaceContainsConstraint :: (Space) -> (Constraint) -> IO ((Bool))
spaceContainsConstraint a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
spaceContainsConstraint'_ a1' a2' >>= \res ->
let {res' = C2HSImp.toBool res} in
return (res')
{-# LINE 203 "src/Chiphunk/Low/Space.chs" #-}
spaceReindexShape :: (Space) -> (Shape) -> IO ()
spaceReindexShape a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
spaceReindexShape'_ a1' a2' >>
return ()
{-# LINE 206 "src/Chiphunk/Low/Space.chs" #-}
spaceReindexShapesForBody :: (Space) -> (Body) -> IO ()
spaceReindexShapesForBody a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
spaceReindexShapesForBody'_ a1' a2' >>
return ()
{-# LINE 209 "src/Chiphunk/Low/Space.chs" #-}
spaceReindexStatic :: (Space) -> IO ()
spaceReindexStatic a1 =
let {a1' = id a1} in
spaceReindexStatic'_ a1' >>
return ()
{-# LINE 212 "src/Chiphunk/Low/Space.chs" #-}
type SpaceBodyIteratorFunc = Body -> Ptr () -> IO ()
foreign import ccall unsafe "wrapper"
mkSpaceBodyIteratorFunc :: SpaceBodyIteratorFunc -> IO (FunPtr SpaceBodyIteratorFunc)
spaceEachBody :: (Space)
-> (SpaceBodyIteratorFunc)
-> (Ptr ())
-> IO ()
spaceEachBody :: Space -> SpaceBodyIteratorFunc -> DataPtr -> IO ()
spaceEachBody Space
a1 SpaceBodyIteratorFunc
a2 DataPtr
a3 =
let {a1' :: Space
a1' = Space -> Space
forall a. a -> a
id Space
a1} in
SpaceBodyIteratorFunc
-> (FunPtr SpaceBodyIteratorFunc -> IO ()) -> IO ()
forall c.
SpaceBodyIteratorFunc
-> (FunPtr SpaceBodyIteratorFunc -> IO c) -> IO c
withIterator SpaceBodyIteratorFunc
a2 ((FunPtr SpaceBodyIteratorFunc -> IO ()) -> IO ())
-> (FunPtr SpaceBodyIteratorFunc -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \FunPtr SpaceBodyIteratorFunc
a2' ->
let {a3' :: DataPtr
a3' = DataPtr -> DataPtr
forall a. a -> a
id DataPtr
a3} in
Space -> FunPtr SpaceBodyIteratorFunc -> DataPtr -> IO ()
spaceEachBody'_ Space
a1' FunPtr SpaceBodyIteratorFunc
a2' DataPtr
a3' IO () -> IO () -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
{-# LINE 226 "src/Chiphunk/Low/Space.chs" #-}
where
withIterator i = mkSpaceBodyIteratorFunc i `bracket` freeHaskellFunPtr
type SpaceShapeIteratorFunc = Shape -> Ptr () -> IO ()
foreign import ccall unsafe "wrapper"
mkSpaceShapeIteratorFunc :: SpaceShapeIteratorFunc -> IO (FunPtr SpaceShapeIteratorFunc)
spaceEachShape :: (Space)
-> (SpaceShapeIteratorFunc)
-> (Ptr ())
-> IO ()
spaceEachShape :: Space -> SpaceShapeIteratorFunc -> DataPtr -> IO ()
spaceEachShape Space
a1 SpaceShapeIteratorFunc
a2 DataPtr
a3 =
let {a1' :: Space
a1' = Space -> Space
forall a. a -> a
id Space
a1} in
SpaceShapeIteratorFunc
-> (FunPtr SpaceShapeIteratorFunc -> IO ()) -> IO ()
forall c.
SpaceShapeIteratorFunc
-> (FunPtr SpaceShapeIteratorFunc -> IO c) -> IO c
withIterator SpaceShapeIteratorFunc
a2 ((FunPtr SpaceShapeIteratorFunc -> IO ()) -> IO ())
-> (FunPtr SpaceShapeIteratorFunc -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \FunPtr SpaceShapeIteratorFunc
a2' ->
let {a3' :: DataPtr
a3' = DataPtr -> DataPtr
forall a. a -> a
id DataPtr
a3} in
Space -> FunPtr SpaceShapeIteratorFunc -> DataPtr -> IO ()
spaceEachShape'_ Space
a1' FunPtr SpaceShapeIteratorFunc
a2' DataPtr
a3' IO () -> IO () -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
{-# LINE 242 "src/Chiphunk/Low/Space.chs" #-}
where
withIterator i = mkSpaceShapeIteratorFunc i `bracket` freeHaskellFunPtr
type SpaceConstraintIteratorFunc = Constraint -> Ptr () -> IO ()
foreign import ccall unsafe "wrapper"
mkSpaceConstraintIteratorFunc :: SpaceConstraintIteratorFunc -> IO (FunPtr SpaceConstraintIteratorFunc)
spaceEachConstraint :: (Space)
-> (SpaceConstraintIteratorFunc)
-> (Ptr ())
-> IO ()
spaceEachConstraint :: Space -> SpaceConstraintIteratorFunc -> DataPtr -> IO ()
spaceEachConstraint Space
a1 SpaceConstraintIteratorFunc
a2 DataPtr
a3 =
let {a1' :: Space
a1' = Space -> Space
forall a. a -> a
id Space
a1} in
SpaceConstraintIteratorFunc
-> (FunPtr SpaceConstraintIteratorFunc -> IO ()) -> IO ()
forall c.
SpaceConstraintIteratorFunc
-> (FunPtr SpaceConstraintIteratorFunc -> IO c) -> IO c
withIterator SpaceConstraintIteratorFunc
a2 ((FunPtr SpaceConstraintIteratorFunc -> IO ()) -> IO ())
-> (FunPtr SpaceConstraintIteratorFunc -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \FunPtr SpaceConstraintIteratorFunc
a2' ->
let {a3' :: DataPtr
a3' = DataPtr -> DataPtr
forall a. a -> a
id DataPtr
a3} in
Space -> FunPtr SpaceConstraintIteratorFunc -> DataPtr -> IO ()
spaceEachConstraint'_ Space
a1' FunPtr SpaceConstraintIteratorFunc
a2' DataPtr
a3' IO () -> IO () -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
{-# LINE 257 "src/Chiphunk/Low/Space.chs" #-}
where
withIterator i = mkSpaceConstraintIteratorFunc i `bracket` freeHaskellFunPtr
spaceStep :: (Space) -> (Double) -> IO ()
spaceStep :: Space -> Double -> IO ()
spaceStep Space
a1 Double
a2 =
let {a1' :: Space
a1' = Space -> Space
forall a. a -> a
id Space
a1} in
let {a2' :: CDouble
a2' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a2} in
Space -> CDouble -> IO ()
spaceStep'_ Space
a1' CDouble
a2' IO () -> IO () -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
{-# LINE 266 "src/Chiphunk/Low/Space.chs" #-}
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceGetIterations"
cpSpaceGetIterations'_ :: ((Space) -> (IO C2HSImp.CInt))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceSetIterations"
cpSpaceSetIterations'_ :: ((Space) -> (C2HSImp.CInt -> (IO ())))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h w_cpSpaceGetGravity"
w_cpSpaceGetGravity'_ :: ((Space) -> ((VectPtr) -> (IO ())))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h __c2hs_wrapped__cpSpaceSetGravity"
cpSpaceSetGravity'_ :: ((Space) -> ((VectPtr) -> (IO ())))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceGetDamping"
cpSpaceGetDamping'_ :: ((Space) -> (IO C2HSImp.CDouble))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceSetDamping"
cpSpaceSetDamping'_ :: ((Space) -> (C2HSImp.CDouble -> (IO ())))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceGetIdleSpeedThreshold"
cpSpaceGetIdleSpeedThreshold'_ :: ((Space) -> (IO C2HSImp.CDouble))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceSetIdleSpeedThreshold"
cpSpaceSetIdleSpeedThreshold'_ :: ((Space) -> (C2HSImp.CDouble -> (IO ())))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceGetSleepTimeThreshold"
cpSpaceGetSleepTimeThreshold'_ :: ((Space) -> (IO C2HSImp.CDouble))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceSetSleepTimeThreshold"
cpSpaceSetSleepTimeThreshold'_ :: ((Space) -> (C2HSImp.CDouble -> (IO ())))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceGetCollisionSlop"
cpSpaceGetCollisionSlop'_ :: ((Space) -> (IO C2HSImp.CDouble))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceSetCollisionSlop"
cpSpaceSetCollisionSlop'_ :: ((Space) -> (C2HSImp.CDouble -> (IO ())))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceGetCollisionBias"
cpSpaceGetCollisionBias'_ :: ((Space) -> (IO C2HSImp.CDouble))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceSetCollisionBias"
cpSpaceSetCollisionBias'_ :: ((Space) -> (C2HSImp.CDouble -> (IO ())))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceGetCollisionPersistence"
cpSpaceGetCollisionPersistence'_ :: ((Space) -> (IO C2HSImp.CUInt))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceSetCollisionPersistence"
cpSpaceSetCollisionPersistence'_ :: ((Space) -> (C2HSImp.CUInt -> (IO ())))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceGetCurrentTimeStep"
cpSpaceGetCurrentTimeStep'_ :: ((Space) -> (IO C2HSImp.CDouble))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceIsLocked"
spaceIsLocked'_ :: ((Space) -> (IO C2HSImp.CUChar))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceGetUserData"
cpSpaceGetUserData'_ :: ((Space) -> (IO (DataPtr)))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceSetUserData"
cpSpaceSetUserData'_ :: ((Space) -> ((DataPtr) -> (IO ())))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceGetStaticBody"
cpSpaceGetStaticBody'_ :: ((Space) -> (IO (Body)))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceNew"
spaceNew'_ :: (IO (Space))
foreign import ccall safe "Chiphunk/Low/Space.chs.h cpSpaceFree"
spaceFree'_ :: ((Space) -> (IO ()))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceAddShape"
spaceAddShape'_ :: ((Space) -> ((Shape) -> (IO (Shape))))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceAddBody"
spaceAddBody'_ :: ((Space) -> ((Body) -> (IO (Body))))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceAddConstraint"
spaceAddConstraint'_ :: ((Space) -> ((Constraint) -> (IO (Constraint))))
foreign import ccall safe "Chiphunk/Low/Space.chs.h cpSpaceRemoveShape"
spaceRemoveShape'_ :: ((Space) -> ((Shape) -> (IO ())))
foreign import ccall safe "Chiphunk/Low/Space.chs.h cpSpaceRemoveBody"
spaceRemoveBody'_ :: ((Space) -> ((Body) -> (IO ())))
foreign import ccall safe "Chiphunk/Low/Space.chs.h cpSpaceRemoveConstraint"
spaceRemoveConstraint'_ :: ((Space) -> ((Constraint) -> (IO ())))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceContainsShape"
spaceContainsShape'_ :: ((Space) -> ((Shape) -> (IO C2HSImp.CUChar)))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceContainsBody"
spaceContainsBody'_ :: ((Space) -> ((Body) -> (IO C2HSImp.CUChar)))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceContainsConstraint"
spaceContainsConstraint'_ :: ((Space) -> ((Constraint) -> (IO C2HSImp.CUChar)))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceReindexShape"
spaceReindexShape'_ :: ((Space) -> ((Shape) -> (IO ())))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceReindexShapesForBody"
spaceReindexShapesForBody'_ :: ((Space) -> ((Body) -> (IO ())))
foreign import ccall unsafe "Chiphunk/Low/Space.chs.h cpSpaceReindexStatic"
spaceReindexStatic'_ :: ((Space) -> (IO ()))
foreign import ccall safe "Chiphunk/Low/Space.chs.h cpSpaceEachBody"
spaceEachBody'_ :: ((Space) -> ((C2HSImp.FunPtr ((Body) -> ((C2HSImp.Ptr ()) -> (IO ())))) -> ((C2HSImp.Ptr ()) -> (IO ()))))
foreign import ccall safe "Chiphunk/Low/Space.chs.h cpSpaceEachShape"
spaceEachShape'_ :: ((Space) -> ((C2HSImp.FunPtr ((Shape) -> ((C2HSImp.Ptr ()) -> (IO ())))) -> ((C2HSImp.Ptr ()) -> (IO ()))))
foreign import ccall safe "Chiphunk/Low/Space.chs.h cpSpaceEachConstraint"
spaceEachConstraint'_ :: ((Space) -> ((C2HSImp.FunPtr ((Constraint) -> ((C2HSImp.Ptr ()) -> (IO ())))) -> ((C2HSImp.Ptr ()) -> (IO ()))))
foreign import ccall safe "Chiphunk/Low/Space.chs.h cpSpaceStep"
spaceStep'_ :: ((Space) -> (C2HSImp.CDouble -> (IO ())))