module Box2D.Shape
( createCircle
, createSegment
, createChainSegment
, createCapsule
, createPolygon
, destroy
, isValid
, getType
, getBody
, getWorld
, isSensor
, setUserData
, getUserData
, setDensity
, getDensity
, setFriction
, getFriction
, setRestitution
, getRestitution
, setUserMaterial
, getUserMaterial
, setSurfaceMaterial
, getSurfaceMaterial
, getSurfaceMaterialInto
, getFilter
, getFilterInto
, setFilter
, enableSensorEvents
, areSensorEventsEnabled
, enableContactEvents
, areContactEventsEnabled
, enablePreSolveEvents
, arePreSolveEventsEnabled
, enableHitEvents
, areHitEventsEnabled
, testPoint
, rayCast
, getCircle
, getCircleInto
, getSegment
, getSegmentInto
, getChainSegment
, getCapsule
, getCapsuleInto
, getPolygon
, getPolygonInto
, setCircle
, setCapsule
, setSegment
, setPolygon
, setChainSegment
, getParentChain
, getContactCapacity
, getContactData
, getSensorCapacity
, getSensorData
, getAABB
, getAABBInto
, computeMassData
, computeMassDataInto
, getClosestPoint
, applyWind
)
where
import Foreign
import Foreign.C.Types (CBool(..), CInt(..))
import Data.Coerce (coerce)
import Box2D.Id (BodyId(..), ChainId(..), ShapeId(..), WorldId(..))
import Box2D.MathTypes (AABB, Pos, Vec2)
import Box2D.Tags (ChainSegment, ContactData)
import Box2D.Types (Capsule, Circle, Filter, MassData, Polygon, Segment, ShapeDef, ShapeType(..), SurfaceMaterial, WorldCastOutput)
foreign import ccall unsafe "b2CreateCircleShape"
c_b2CreateCircleShape :: BodyId -> Ptr ShapeDef -> Ptr Circle -> IO ShapeId
foreign import ccall unsafe "b2CreateSegmentShape"
c_b2CreateSegmentShape :: BodyId -> Ptr ShapeDef -> Ptr Segment -> IO ShapeId
foreign import ccall unsafe "b2CreateChainSegmentShape"
c_b2CreateChainSegmentShape :: BodyId -> Ptr ShapeDef -> Ptr ChainSegment -> IO ShapeId
foreign import ccall unsafe "b2CreateCapsuleShape"
c_b2CreateCapsuleShape :: BodyId -> Ptr ShapeDef -> Ptr Capsule -> IO ShapeId
foreign import ccall unsafe "b2CreatePolygonShape"
c_b2CreatePolygonShape :: BodyId -> Ptr ShapeDef -> Ptr Polygon -> IO ShapeId
foreign import ccall unsafe "b2DestroyShape"
c_b2DestroyShape :: ShapeId -> CBool -> IO ()
foreign import ccall unsafe "b2Shape_IsValid"
c_b2Shape_IsValid :: ShapeId -> IO CBool
foreign import ccall unsafe "b2Shape_GetType"
c_b2Shape_GetType :: ShapeId -> IO CInt
foreign import ccall unsafe "b2Shape_GetBody"
c_b2Shape_GetBody :: ShapeId -> IO BodyId
foreign import ccall unsafe "b2Shape_GetWorld"
c_b2Shape_GetWorld :: ShapeId -> IO WorldId
foreign import ccall unsafe "b2Shape_IsSensor"
c_b2Shape_IsSensor :: ShapeId -> IO CBool
foreign import ccall unsafe "b2Shape_SetUserData"
c_b2Shape_SetUserData :: ShapeId -> Ptr () -> IO ()
foreign import ccall unsafe "b2Shape_GetUserData"
c_b2Shape_GetUserData :: ShapeId -> IO (Ptr ())
foreign import ccall unsafe "b2Shape_SetDensity"
c_b2Shape_SetDensity :: ShapeId -> Float -> CBool -> IO ()
foreign import ccall unsafe "b2Shape_GetDensity"
c_b2Shape_GetDensity :: ShapeId -> IO Float
foreign import ccall unsafe "b2Shape_SetFriction"
c_b2Shape_SetFriction :: ShapeId -> Float -> IO ()
foreign import ccall unsafe "b2Shape_GetFriction"
c_b2Shape_GetFriction :: ShapeId -> IO Float
foreign import ccall unsafe "b2Shape_SetRestitution"
c_b2Shape_SetRestitution :: ShapeId -> Float -> IO ()
foreign import ccall unsafe "b2Shape_GetRestitution"
c_b2Shape_GetRestitution :: ShapeId -> IO Float
foreign import ccall unsafe "b2Shape_SetUserMaterial"
c_b2Shape_SetUserMaterial :: ShapeId -> Word64 -> IO ()
foreign import ccall unsafe "b2Shape_GetUserMaterial"
c_b2Shape_GetUserMaterial :: ShapeId -> IO Word64
foreign import ccall unsafe "b2Shape_SetSurfaceMaterial"
c_b2Shape_SetSurfaceMaterial :: ShapeId -> Ptr SurfaceMaterial -> IO ()
foreign import ccall unsafe "hsg_b2Shape_GetSurfaceMaterial"
c_b2Shape_GetSurfaceMaterial :: ShapeId -> Ptr SurfaceMaterial -> IO ()
foreign import ccall unsafe "hsg_b2Shape_GetFilter"
c_b2Shape_GetFilter :: ShapeId -> Ptr Filter -> IO ()
foreign import ccall unsafe "hsg_b2Shape_SetFilter"
c_b2Shape_SetFilter :: ShapeId -> Ptr Filter -> IO ()
foreign import ccall unsafe "b2Shape_EnableSensorEvents"
c_b2Shape_EnableSensorEvents :: ShapeId -> CBool -> IO ()
foreign import ccall unsafe "b2Shape_AreSensorEventsEnabled"
c_b2Shape_AreSensorEventsEnabled :: ShapeId -> IO CBool
foreign import ccall unsafe "b2Shape_EnableContactEvents"
c_b2Shape_EnableContactEvents :: ShapeId -> CBool -> IO ()
foreign import ccall unsafe "b2Shape_AreContactEventsEnabled"
c_b2Shape_AreContactEventsEnabled :: ShapeId -> IO CBool
foreign import ccall unsafe "b2Shape_EnablePreSolveEvents"
c_b2Shape_EnablePreSolveEvents :: ShapeId -> CBool -> IO ()
foreign import ccall unsafe "b2Shape_ArePreSolveEventsEnabled"
c_b2Shape_ArePreSolveEventsEnabled :: ShapeId -> IO CBool
foreign import ccall unsafe "b2Shape_EnableHitEvents"
c_b2Shape_EnableHitEvents :: ShapeId -> CBool -> IO ()
foreign import ccall unsafe "b2Shape_AreHitEventsEnabled"
c_b2Shape_AreHitEventsEnabled :: ShapeId -> IO CBool
foreign import ccall unsafe "hsg_b2Shape_TestPoint"
c_b2Shape_TestPoint :: ShapeId -> Ptr Pos -> IO CBool
foreign import ccall unsafe "hsg_b2Shape_RayCast"
c_b2Shape_RayCast :: ShapeId -> Ptr Pos -> Ptr Vec2 -> Ptr WorldCastOutput -> IO ()
foreign import ccall unsafe "hsg_b2Shape_GetCircle"
c_b2Shape_GetCircle :: ShapeId -> Ptr Circle -> IO ()
foreign import ccall unsafe "hsg_b2Shape_GetSegment"
c_b2Shape_GetSegment :: ShapeId -> Ptr Segment -> IO ()
foreign import ccall unsafe "hsg_b2Shape_GetChainSegment"
c_b2Shape_GetChainSegment :: ShapeId -> Ptr ChainSegment -> IO ()
foreign import ccall unsafe "hsg_b2Shape_GetCapsule"
c_b2Shape_GetCapsule :: ShapeId -> Ptr Capsule -> IO ()
foreign import ccall unsafe "hsg_b2Shape_GetPolygon"
c_b2Shape_GetPolygon :: ShapeId -> Ptr Polygon -> IO ()
foreign import ccall unsafe "b2Shape_SetCircle"
c_b2Shape_SetCircle :: ShapeId -> Ptr Circle -> IO ()
foreign import ccall unsafe "b2Shape_SetCapsule"
c_b2Shape_SetCapsule :: ShapeId -> Ptr Capsule -> IO ()
foreign import ccall unsafe "b2Shape_SetSegment"
c_b2Shape_SetSegment :: ShapeId -> Ptr Segment -> IO ()
foreign import ccall unsafe "b2Shape_SetPolygon"
c_b2Shape_SetPolygon :: ShapeId -> Ptr Polygon -> IO ()
foreign import ccall unsafe "b2Shape_SetChainSegment"
c_b2Shape_SetChainSegment :: ShapeId -> Ptr ChainSegment -> IO ()
foreign import ccall unsafe "b2Shape_GetParentChain"
c_b2Shape_GetParentChain :: ShapeId -> IO ChainId
foreign import ccall unsafe "b2Shape_GetContactCapacity"
c_b2Shape_GetContactCapacity :: ShapeId -> IO CInt
foreign import ccall unsafe "b2Shape_GetContactData"
c_b2Shape_GetContactData :: ShapeId -> Ptr ContactData -> CInt -> IO CInt
foreign import ccall unsafe "b2Shape_GetSensorCapacity"
c_b2Shape_GetSensorCapacity :: ShapeId -> IO CInt
foreign import ccall unsafe "b2Shape_GetSensorData"
c_b2Shape_GetSensorData :: ShapeId -> Ptr ShapeId -> CInt -> IO CInt
foreign import ccall unsafe "hsg_b2Shape_GetAABB"
c_b2Shape_GetAABB :: ShapeId -> Ptr AABB -> IO ()
foreign import ccall unsafe "hsg_b2Shape_ComputeMassData"
c_b2Shape_ComputeMassData :: ShapeId -> Ptr MassData -> IO ()
foreign import ccall unsafe "hsg_b2Shape_GetClosestPoint"
c_b2Shape_GetClosestPoint :: ShapeId -> Ptr Pos -> Ptr Pos -> IO ()
foreign import ccall unsafe "hsg_b2Shape_ApplyWind"
c_b2Shape_ApplyWind :: ShapeId -> Ptr Vec2 -> Float -> Float -> CBool -> IO ()
createCircle
:: BodyId
-> ShapeDef
-> Circle
-> IO ShapeId
createCircle :: BodyId -> ShapeDef -> Circle -> IO ShapeId
createCircle BodyId
a0 ShapeDef
a1 Circle
a2 =
ShapeDef -> (Ptr ShapeDef -> IO ShapeId) -> IO ShapeId
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ShapeDef
a1 ((Ptr ShapeDef -> IO ShapeId) -> IO ShapeId)
-> (Ptr ShapeDef -> IO ShapeId) -> IO ShapeId
forall a b. (a -> b) -> a -> b
$ \Ptr ShapeDef
p1 ->
Circle -> (Ptr Circle -> IO ShapeId) -> IO ShapeId
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Circle
a2 ((Ptr Circle -> IO ShapeId) -> IO ShapeId)
-> (Ptr Circle -> IO ShapeId) -> IO ShapeId
forall a b. (a -> b) -> a -> b
$ \Ptr Circle
p2 ->
BodyId -> Ptr ShapeDef -> Ptr Circle -> IO ShapeId
c_b2CreateCircleShape BodyId
a0 Ptr ShapeDef
p1 Ptr Circle
p2
createSegment
:: BodyId
-> ShapeDef
-> Segment
-> IO ShapeId
createSegment :: BodyId -> ShapeDef -> Segment -> IO ShapeId
createSegment BodyId
a0 ShapeDef
a1 Segment
a2 =
ShapeDef -> (Ptr ShapeDef -> IO ShapeId) -> IO ShapeId
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ShapeDef
a1 ((Ptr ShapeDef -> IO ShapeId) -> IO ShapeId)
-> (Ptr ShapeDef -> IO ShapeId) -> IO ShapeId
forall a b. (a -> b) -> a -> b
$ \Ptr ShapeDef
p1 ->
Segment -> (Ptr Segment -> IO ShapeId) -> IO ShapeId
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Segment
a2 ((Ptr Segment -> IO ShapeId) -> IO ShapeId)
-> (Ptr Segment -> IO ShapeId) -> IO ShapeId
forall a b. (a -> b) -> a -> b
$ \Ptr Segment
p2 ->
BodyId -> Ptr ShapeDef -> Ptr Segment -> IO ShapeId
c_b2CreateSegmentShape BodyId
a0 Ptr ShapeDef
p1 Ptr Segment
p2
createChainSegment
:: BodyId
-> ShapeDef
-> Ptr ChainSegment
-> IO ShapeId
createChainSegment :: BodyId -> ShapeDef -> Ptr ChainSegment -> IO ShapeId
createChainSegment BodyId
a0 ShapeDef
a1 Ptr ChainSegment
a2 =
ShapeDef -> (Ptr ShapeDef -> IO ShapeId) -> IO ShapeId
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ShapeDef
a1 ((Ptr ShapeDef -> IO ShapeId) -> IO ShapeId)
-> (Ptr ShapeDef -> IO ShapeId) -> IO ShapeId
forall a b. (a -> b) -> a -> b
$ \Ptr ShapeDef
p1 ->
BodyId -> Ptr ShapeDef -> Ptr ChainSegment -> IO ShapeId
c_b2CreateChainSegmentShape BodyId
a0 Ptr ShapeDef
p1 Ptr ChainSegment
a2
createCapsule
:: BodyId
-> ShapeDef
-> Capsule
-> IO ShapeId
createCapsule :: BodyId -> ShapeDef -> Capsule -> IO ShapeId
createCapsule BodyId
a0 ShapeDef
a1 Capsule
a2 =
ShapeDef -> (Ptr ShapeDef -> IO ShapeId) -> IO ShapeId
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ShapeDef
a1 ((Ptr ShapeDef -> IO ShapeId) -> IO ShapeId)
-> (Ptr ShapeDef -> IO ShapeId) -> IO ShapeId
forall a b. (a -> b) -> a -> b
$ \Ptr ShapeDef
p1 ->
Capsule -> (Ptr Capsule -> IO ShapeId) -> IO ShapeId
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Capsule
a2 ((Ptr Capsule -> IO ShapeId) -> IO ShapeId)
-> (Ptr Capsule -> IO ShapeId) -> IO ShapeId
forall a b. (a -> b) -> a -> b
$ \Ptr Capsule
p2 ->
BodyId -> Ptr ShapeDef -> Ptr Capsule -> IO ShapeId
c_b2CreateCapsuleShape BodyId
a0 Ptr ShapeDef
p1 Ptr Capsule
p2
createPolygon
:: BodyId
-> ShapeDef
-> Polygon
-> IO ShapeId
createPolygon :: BodyId -> ShapeDef -> Polygon -> IO ShapeId
createPolygon BodyId
a0 ShapeDef
a1 Polygon
a2 =
ShapeDef -> (Ptr ShapeDef -> IO ShapeId) -> IO ShapeId
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ShapeDef
a1 ((Ptr ShapeDef -> IO ShapeId) -> IO ShapeId)
-> (Ptr ShapeDef -> IO ShapeId) -> IO ShapeId
forall a b. (a -> b) -> a -> b
$ \Ptr ShapeDef
p1 ->
Polygon -> (Ptr Polygon -> IO ShapeId) -> IO ShapeId
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Polygon
a2 ((Ptr Polygon -> IO ShapeId) -> IO ShapeId)
-> (Ptr Polygon -> IO ShapeId) -> IO ShapeId
forall a b. (a -> b) -> a -> b
$ \Ptr Polygon
p2 ->
BodyId -> Ptr ShapeDef -> Ptr Polygon -> IO ShapeId
c_b2CreatePolygonShape BodyId
a0 Ptr ShapeDef
p1 Ptr Polygon
p2
destroy
:: ShapeId
-> Bool
-> IO ()
destroy :: ShapeId -> Bool -> IO ()
destroy ShapeId
a0 Bool
a1 =
ShapeId -> CBool -> IO ()
c_b2DestroyShape ShapeId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)
isValid
:: ShapeId
-> IO Bool
isValid :: ShapeId -> IO Bool
isValid ShapeId
a0 =
CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ShapeId -> IO CBool
c_b2Shape_IsValid ShapeId
a0)
getType
:: ShapeId
-> IO ShapeType
getType :: ShapeId -> IO ShapeType
getType ShapeId
a0 =
CInt -> ShapeType
forall a b. Coercible a b => a -> b
coerce (CInt -> ShapeType) -> IO CInt -> IO ShapeType
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ShapeId -> IO CInt
c_b2Shape_GetType ShapeId
a0)
getBody
:: ShapeId
-> IO BodyId
getBody :: ShapeId -> IO BodyId
getBody ShapeId
a0 =
ShapeId -> IO BodyId
c_b2Shape_GetBody ShapeId
a0
getWorld
:: ShapeId
-> IO WorldId
getWorld :: ShapeId -> IO WorldId
getWorld ShapeId
a0 =
ShapeId -> IO WorldId
c_b2Shape_GetWorld ShapeId
a0
isSensor
:: ShapeId
-> IO Bool
isSensor :: ShapeId -> IO Bool
isSensor ShapeId
a0 =
CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ShapeId -> IO CBool
c_b2Shape_IsSensor ShapeId
a0)
setUserData
:: ShapeId
-> Ptr ()
-> IO ()
setUserData :: ShapeId -> Ptr () -> IO ()
setUserData ShapeId
a0 Ptr ()
a1 =
ShapeId -> Ptr () -> IO ()
c_b2Shape_SetUserData ShapeId
a0 Ptr ()
a1
getUserData
:: ShapeId
-> IO (Ptr ())
getUserData :: ShapeId -> IO (Ptr ())
getUserData ShapeId
a0 =
ShapeId -> IO (Ptr ())
c_b2Shape_GetUserData ShapeId
a0
setDensity
:: ShapeId
-> Float
-> Bool
-> IO ()
setDensity :: ShapeId -> Float -> Bool -> IO ()
setDensity ShapeId
a0 Float
a1 Bool
a2 =
ShapeId -> Float -> CBool -> IO ()
c_b2Shape_SetDensity ShapeId
a0 Float
a1 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a2)
getDensity
:: ShapeId
-> IO Float
getDensity :: ShapeId -> IO Float
getDensity ShapeId
a0 =
ShapeId -> IO Float
c_b2Shape_GetDensity ShapeId
a0
setFriction
:: ShapeId
-> Float
-> IO ()
setFriction :: ShapeId -> Float -> IO ()
setFriction ShapeId
a0 Float
a1 =
ShapeId -> Float -> IO ()
c_b2Shape_SetFriction ShapeId
a0 Float
a1
getFriction
:: ShapeId
-> IO Float
getFriction :: ShapeId -> IO Float
getFriction ShapeId
a0 =
ShapeId -> IO Float
c_b2Shape_GetFriction ShapeId
a0
setRestitution
:: ShapeId
-> Float
-> IO ()
setRestitution :: ShapeId -> Float -> IO ()
setRestitution ShapeId
a0 Float
a1 =
ShapeId -> Float -> IO ()
c_b2Shape_SetRestitution ShapeId
a0 Float
a1
getRestitution
:: ShapeId
-> IO Float
getRestitution :: ShapeId -> IO Float
getRestitution ShapeId
a0 =
ShapeId -> IO Float
c_b2Shape_GetRestitution ShapeId
a0
setUserMaterial
:: ShapeId
-> Word64
-> IO ()
setUserMaterial :: ShapeId -> Word64 -> IO ()
setUserMaterial ShapeId
a0 Word64
a1 =
ShapeId -> Word64 -> IO ()
c_b2Shape_SetUserMaterial ShapeId
a0 Word64
a1
getUserMaterial
:: ShapeId
-> IO Word64
getUserMaterial :: ShapeId -> IO Word64
getUserMaterial ShapeId
a0 =
ShapeId -> IO Word64
c_b2Shape_GetUserMaterial ShapeId
a0
setSurfaceMaterial
:: ShapeId
-> SurfaceMaterial
-> IO ()
setSurfaceMaterial :: ShapeId -> SurfaceMaterial -> IO ()
setSurfaceMaterial ShapeId
a0 SurfaceMaterial
a1 =
SurfaceMaterial -> (Ptr SurfaceMaterial -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with SurfaceMaterial
a1 ((Ptr SurfaceMaterial -> IO ()) -> IO ())
-> (Ptr SurfaceMaterial -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr SurfaceMaterial
p1 ->
ShapeId -> Ptr SurfaceMaterial -> IO ()
c_b2Shape_SetSurfaceMaterial ShapeId
a0 Ptr SurfaceMaterial
p1
getSurfaceMaterial
:: ShapeId
-> IO SurfaceMaterial
getSurfaceMaterial :: ShapeId -> IO SurfaceMaterial
getSurfaceMaterial ShapeId
a0 =
(Ptr SurfaceMaterial -> IO SurfaceMaterial) -> IO SurfaceMaterial
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr SurfaceMaterial -> IO SurfaceMaterial) -> IO SurfaceMaterial)
-> (Ptr SurfaceMaterial -> IO SurfaceMaterial)
-> IO SurfaceMaterial
forall a b. (a -> b) -> a -> b
$ \Ptr SurfaceMaterial
pOut -> ShapeId -> Ptr SurfaceMaterial -> IO ()
c_b2Shape_GetSurfaceMaterial ShapeId
a0 Ptr SurfaceMaterial
pOut IO () -> IO SurfaceMaterial -> IO SurfaceMaterial
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr SurfaceMaterial -> IO SurfaceMaterial
forall a. Storable a => Ptr a -> IO a
peek Ptr SurfaceMaterial
pOut
getSurfaceMaterialInto
:: ShapeId
-> Ptr SurfaceMaterial
-> IO ()
getSurfaceMaterialInto :: ShapeId -> Ptr SurfaceMaterial -> IO ()
getSurfaceMaterialInto ShapeId
a0 Ptr SurfaceMaterial
out =
ShapeId -> Ptr SurfaceMaterial -> IO ()
c_b2Shape_GetSurfaceMaterial ShapeId
a0 Ptr SurfaceMaterial
out
getFilter
:: ShapeId
-> IO Filter
getFilter :: ShapeId -> IO Filter
getFilter ShapeId
a0 =
(Ptr Filter -> IO Filter) -> IO Filter
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Filter -> IO Filter) -> IO Filter)
-> (Ptr Filter -> IO Filter) -> IO Filter
forall a b. (a -> b) -> a -> b
$ \Ptr Filter
pOut -> ShapeId -> Ptr Filter -> IO ()
c_b2Shape_GetFilter ShapeId
a0 Ptr Filter
pOut IO () -> IO Filter -> IO Filter
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Filter -> IO Filter
forall a. Storable a => Ptr a -> IO a
peek Ptr Filter
pOut
getFilterInto
:: ShapeId
-> Ptr Filter
-> IO ()
getFilterInto :: ShapeId -> Ptr Filter -> IO ()
getFilterInto ShapeId
a0 Ptr Filter
out =
ShapeId -> Ptr Filter -> IO ()
c_b2Shape_GetFilter ShapeId
a0 Ptr Filter
out
setFilter
:: ShapeId
-> Filter
-> IO ()
setFilter :: ShapeId -> Filter -> IO ()
setFilter ShapeId
a0 Filter
a1 =
Filter -> (Ptr Filter -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Filter
a1 ((Ptr Filter -> IO ()) -> IO ()) -> (Ptr Filter -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Filter
p1 ->
ShapeId -> Ptr Filter -> IO ()
c_b2Shape_SetFilter ShapeId
a0 Ptr Filter
p1
enableSensorEvents
:: ShapeId
-> Bool
-> IO ()
enableSensorEvents :: ShapeId -> Bool -> IO ()
enableSensorEvents ShapeId
a0 Bool
a1 =
ShapeId -> CBool -> IO ()
c_b2Shape_EnableSensorEvents ShapeId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)
areSensorEventsEnabled
:: ShapeId
-> IO Bool
areSensorEventsEnabled :: ShapeId -> IO Bool
areSensorEventsEnabled ShapeId
a0 =
CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ShapeId -> IO CBool
c_b2Shape_AreSensorEventsEnabled ShapeId
a0)
enableContactEvents
:: ShapeId
-> Bool
-> IO ()
enableContactEvents :: ShapeId -> Bool -> IO ()
enableContactEvents ShapeId
a0 Bool
a1 =
ShapeId -> CBool -> IO ()
c_b2Shape_EnableContactEvents ShapeId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)
areContactEventsEnabled
:: ShapeId
-> IO Bool
areContactEventsEnabled :: ShapeId -> IO Bool
areContactEventsEnabled ShapeId
a0 =
CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ShapeId -> IO CBool
c_b2Shape_AreContactEventsEnabled ShapeId
a0)
enablePreSolveEvents
:: ShapeId
-> Bool
-> IO ()
enablePreSolveEvents :: ShapeId -> Bool -> IO ()
enablePreSolveEvents ShapeId
a0 Bool
a1 =
ShapeId -> CBool -> IO ()
c_b2Shape_EnablePreSolveEvents ShapeId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)
arePreSolveEventsEnabled
:: ShapeId
-> IO Bool
arePreSolveEventsEnabled :: ShapeId -> IO Bool
arePreSolveEventsEnabled ShapeId
a0 =
CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ShapeId -> IO CBool
c_b2Shape_ArePreSolveEventsEnabled ShapeId
a0)
enableHitEvents
:: ShapeId
-> Bool
-> IO ()
enableHitEvents :: ShapeId -> Bool -> IO ()
enableHitEvents ShapeId
a0 Bool
a1 =
ShapeId -> CBool -> IO ()
c_b2Shape_EnableHitEvents ShapeId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)
areHitEventsEnabled
:: ShapeId
-> IO Bool
areHitEventsEnabled :: ShapeId -> IO Bool
areHitEventsEnabled ShapeId
a0 =
CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ShapeId -> IO CBool
c_b2Shape_AreHitEventsEnabled ShapeId
a0)
testPoint
:: ShapeId
-> Pos
-> IO Bool
testPoint :: ShapeId -> Vec2 -> IO Bool
testPoint ShapeId
a0 Vec2
a1 =
Vec2 -> (Ptr Vec2 -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec2
a1 ((Ptr Vec2 -> IO Bool) -> IO Bool)
-> (Ptr Vec2 -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Ptr Vec2
p1 ->
CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ShapeId -> Ptr Vec2 -> IO CBool
c_b2Shape_TestPoint ShapeId
a0 Ptr Vec2
p1)
rayCast
:: ShapeId
-> Pos
-> Vec2
-> IO WorldCastOutput
rayCast :: ShapeId -> Vec2 -> Vec2 -> IO WorldCastOutput
rayCast ShapeId
a0 Vec2
a1 Vec2
a2 =
Vec2 -> (Ptr Vec2 -> IO WorldCastOutput) -> IO WorldCastOutput
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec2
a1 ((Ptr Vec2 -> IO WorldCastOutput) -> IO WorldCastOutput)
-> (Ptr Vec2 -> IO WorldCastOutput) -> IO WorldCastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr Vec2
p1 ->
Vec2 -> (Ptr Vec2 -> IO WorldCastOutput) -> IO WorldCastOutput
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec2
a2 ((Ptr Vec2 -> IO WorldCastOutput) -> IO WorldCastOutput)
-> (Ptr Vec2 -> IO WorldCastOutput) -> IO WorldCastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr Vec2
p2 ->
(Ptr WorldCastOutput -> IO WorldCastOutput) -> IO WorldCastOutput
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr WorldCastOutput -> IO WorldCastOutput) -> IO WorldCastOutput)
-> (Ptr WorldCastOutput -> IO WorldCastOutput)
-> IO WorldCastOutput
forall a b. (a -> b) -> a -> b
$ \Ptr WorldCastOutput
pOut -> ShapeId -> Ptr Vec2 -> Ptr Vec2 -> Ptr WorldCastOutput -> IO ()
c_b2Shape_RayCast ShapeId
a0 Ptr Vec2
p1 Ptr Vec2
p2 Ptr WorldCastOutput
pOut IO () -> IO WorldCastOutput -> IO WorldCastOutput
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr WorldCastOutput -> IO WorldCastOutput
forall a. Storable a => Ptr a -> IO a
peek Ptr WorldCastOutput
pOut
getCircle
:: ShapeId
-> IO Circle
getCircle :: ShapeId -> IO Circle
getCircle ShapeId
a0 =
(Ptr Circle -> IO Circle) -> IO Circle
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Circle -> IO Circle) -> IO Circle)
-> (Ptr Circle -> IO Circle) -> IO Circle
forall a b. (a -> b) -> a -> b
$ \Ptr Circle
pOut -> ShapeId -> Ptr Circle -> IO ()
c_b2Shape_GetCircle ShapeId
a0 Ptr Circle
pOut IO () -> IO Circle -> IO Circle
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Circle -> IO Circle
forall a. Storable a => Ptr a -> IO a
peek Ptr Circle
pOut
getCircleInto
:: ShapeId
-> Ptr Circle
-> IO ()
getCircleInto :: ShapeId -> Ptr Circle -> IO ()
getCircleInto ShapeId
a0 Ptr Circle
out =
ShapeId -> Ptr Circle -> IO ()
c_b2Shape_GetCircle ShapeId
a0 Ptr Circle
out
getSegment
:: ShapeId
-> IO Segment
getSegment :: ShapeId -> IO Segment
getSegment ShapeId
a0 =
(Ptr Segment -> IO Segment) -> IO Segment
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Segment -> IO Segment) -> IO Segment)
-> (Ptr Segment -> IO Segment) -> IO Segment
forall a b. (a -> b) -> a -> b
$ \Ptr Segment
pOut -> ShapeId -> Ptr Segment -> IO ()
c_b2Shape_GetSegment ShapeId
a0 Ptr Segment
pOut IO () -> IO Segment -> IO Segment
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Segment -> IO Segment
forall a. Storable a => Ptr a -> IO a
peek Ptr Segment
pOut
getSegmentInto
:: ShapeId
-> Ptr Segment
-> IO ()
getSegmentInto :: ShapeId -> Ptr Segment -> IO ()
getSegmentInto ShapeId
a0 Ptr Segment
out =
ShapeId -> Ptr Segment -> IO ()
c_b2Shape_GetSegment ShapeId
a0 Ptr Segment
out
getChainSegment
:: ShapeId
-> Ptr ChainSegment
-> IO ()
getChainSegment :: ShapeId -> Ptr ChainSegment -> IO ()
getChainSegment ShapeId
a0 Ptr ChainSegment
out =
ShapeId -> Ptr ChainSegment -> IO ()
c_b2Shape_GetChainSegment ShapeId
a0 Ptr ChainSegment
out
getCapsule
:: ShapeId
-> IO Capsule
getCapsule :: ShapeId -> IO Capsule
getCapsule ShapeId
a0 =
(Ptr Capsule -> IO Capsule) -> IO Capsule
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Capsule -> IO Capsule) -> IO Capsule)
-> (Ptr Capsule -> IO Capsule) -> IO Capsule
forall a b. (a -> b) -> a -> b
$ \Ptr Capsule
pOut -> ShapeId -> Ptr Capsule -> IO ()
c_b2Shape_GetCapsule ShapeId
a0 Ptr Capsule
pOut IO () -> IO Capsule -> IO Capsule
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Capsule -> IO Capsule
forall a. Storable a => Ptr a -> IO a
peek Ptr Capsule
pOut
getCapsuleInto
:: ShapeId
-> Ptr Capsule
-> IO ()
getCapsuleInto :: ShapeId -> Ptr Capsule -> IO ()
getCapsuleInto ShapeId
a0 Ptr Capsule
out =
ShapeId -> Ptr Capsule -> IO ()
c_b2Shape_GetCapsule ShapeId
a0 Ptr Capsule
out
getPolygon
:: ShapeId
-> IO Polygon
getPolygon :: ShapeId -> IO Polygon
getPolygon ShapeId
a0 =
(Ptr Polygon -> IO Polygon) -> IO Polygon
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Polygon -> IO Polygon) -> IO Polygon)
-> (Ptr Polygon -> IO Polygon) -> IO Polygon
forall a b. (a -> b) -> a -> b
$ \Ptr Polygon
pOut -> ShapeId -> Ptr Polygon -> IO ()
c_b2Shape_GetPolygon ShapeId
a0 Ptr Polygon
pOut IO () -> IO Polygon -> IO Polygon
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Polygon -> IO Polygon
forall a. Storable a => Ptr a -> IO a
peek Ptr Polygon
pOut
getPolygonInto
:: ShapeId
-> Ptr Polygon
-> IO ()
getPolygonInto :: ShapeId -> Ptr Polygon -> IO ()
getPolygonInto ShapeId
a0 Ptr Polygon
out =
ShapeId -> Ptr Polygon -> IO ()
c_b2Shape_GetPolygon ShapeId
a0 Ptr Polygon
out
setCircle
:: ShapeId
-> Circle
-> IO ()
setCircle :: ShapeId -> Circle -> IO ()
setCircle ShapeId
a0 Circle
a1 =
Circle -> (Ptr Circle -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Circle
a1 ((Ptr Circle -> IO ()) -> IO ()) -> (Ptr Circle -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Circle
p1 ->
ShapeId -> Ptr Circle -> IO ()
c_b2Shape_SetCircle ShapeId
a0 Ptr Circle
p1
setCapsule
:: ShapeId
-> Capsule
-> IO ()
setCapsule :: ShapeId -> Capsule -> IO ()
setCapsule ShapeId
a0 Capsule
a1 =
Capsule -> (Ptr Capsule -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Capsule
a1 ((Ptr Capsule -> IO ()) -> IO ())
-> (Ptr Capsule -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Capsule
p1 ->
ShapeId -> Ptr Capsule -> IO ()
c_b2Shape_SetCapsule ShapeId
a0 Ptr Capsule
p1
setSegment
:: ShapeId
-> Segment
-> IO ()
setSegment :: ShapeId -> Segment -> IO ()
setSegment ShapeId
a0 Segment
a1 =
Segment -> (Ptr Segment -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Segment
a1 ((Ptr Segment -> IO ()) -> IO ())
-> (Ptr Segment -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Segment
p1 ->
ShapeId -> Ptr Segment -> IO ()
c_b2Shape_SetSegment ShapeId
a0 Ptr Segment
p1
setPolygon
:: ShapeId
-> Polygon
-> IO ()
setPolygon :: ShapeId -> Polygon -> IO ()
setPolygon ShapeId
a0 Polygon
a1 =
Polygon -> (Ptr Polygon -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Polygon
a1 ((Ptr Polygon -> IO ()) -> IO ())
-> (Ptr Polygon -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Polygon
p1 ->
ShapeId -> Ptr Polygon -> IO ()
c_b2Shape_SetPolygon ShapeId
a0 Ptr Polygon
p1
setChainSegment
:: ShapeId
-> Ptr ChainSegment
-> IO ()
setChainSegment :: ShapeId -> Ptr ChainSegment -> IO ()
setChainSegment ShapeId
a0 Ptr ChainSegment
a1 =
ShapeId -> Ptr ChainSegment -> IO ()
c_b2Shape_SetChainSegment ShapeId
a0 Ptr ChainSegment
a1
getParentChain
:: ShapeId
-> IO ChainId
getParentChain :: ShapeId -> IO ChainId
getParentChain ShapeId
a0 =
ShapeId -> IO ChainId
c_b2Shape_GetParentChain ShapeId
a0
getContactCapacity
:: ShapeId
-> IO Int
getContactCapacity :: ShapeId -> IO Int
getContactCapacity ShapeId
a0 =
CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ShapeId -> IO CInt
c_b2Shape_GetContactCapacity ShapeId
a0)
getContactData
:: ShapeId
-> Ptr ContactData
-> Int
-> IO Int
getContactData :: ShapeId -> Ptr ContactData -> Int -> IO Int
getContactData ShapeId
a0 Ptr ContactData
a1 Int
a2 =
CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ShapeId -> Ptr ContactData -> CInt -> IO CInt
c_b2Shape_GetContactData ShapeId
a0 Ptr ContactData
a1 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a2))
getSensorCapacity
:: ShapeId
-> IO Int
getSensorCapacity :: ShapeId -> IO Int
getSensorCapacity ShapeId
a0 =
CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ShapeId -> IO CInt
c_b2Shape_GetSensorCapacity ShapeId
a0)
getSensorData
:: ShapeId
-> Ptr ShapeId
-> Int
-> IO Int
getSensorData :: ShapeId -> Ptr ShapeId -> Int -> IO Int
getSensorData ShapeId
a0 Ptr ShapeId
a1 Int
a2 =
CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ShapeId -> Ptr ShapeId -> CInt -> IO CInt
c_b2Shape_GetSensorData ShapeId
a0 Ptr ShapeId
a1 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a2))
getAABB
:: ShapeId
-> IO AABB
getAABB :: ShapeId -> IO AABB
getAABB ShapeId
a0 =
(Ptr AABB -> IO AABB) -> IO AABB
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AABB -> IO AABB) -> IO AABB)
-> (Ptr AABB -> IO AABB) -> IO AABB
forall a b. (a -> b) -> a -> b
$ \Ptr AABB
pOut -> ShapeId -> Ptr AABB -> IO ()
c_b2Shape_GetAABB ShapeId
a0 Ptr AABB
pOut IO () -> IO AABB -> IO AABB
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr AABB -> IO AABB
forall a. Storable a => Ptr a -> IO a
peek Ptr AABB
pOut
getAABBInto
:: ShapeId
-> Ptr AABB
-> IO ()
getAABBInto :: ShapeId -> Ptr AABB -> IO ()
getAABBInto ShapeId
a0 Ptr AABB
out =
ShapeId -> Ptr AABB -> IO ()
c_b2Shape_GetAABB ShapeId
a0 Ptr AABB
out
computeMassData
:: ShapeId
-> IO MassData
computeMassData :: ShapeId -> IO MassData
computeMassData ShapeId
a0 =
(Ptr MassData -> IO MassData) -> IO MassData
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr MassData -> IO MassData) -> IO MassData)
-> (Ptr MassData -> IO MassData) -> IO MassData
forall a b. (a -> b) -> a -> b
$ \Ptr MassData
pOut -> ShapeId -> Ptr MassData -> IO ()
c_b2Shape_ComputeMassData ShapeId
a0 Ptr MassData
pOut IO () -> IO MassData -> IO MassData
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr MassData -> IO MassData
forall a. Storable a => Ptr a -> IO a
peek Ptr MassData
pOut
computeMassDataInto
:: ShapeId
-> Ptr MassData
-> IO ()
computeMassDataInto :: ShapeId -> Ptr MassData -> IO ()
computeMassDataInto ShapeId
a0 Ptr MassData
out =
ShapeId -> Ptr MassData -> IO ()
c_b2Shape_ComputeMassData ShapeId
a0 Ptr MassData
out
getClosestPoint
:: ShapeId
-> Pos
-> IO Pos
getClosestPoint :: ShapeId -> Vec2 -> IO Vec2
getClosestPoint ShapeId
a0 Vec2
a1 =
Vec2 -> (Ptr Vec2 -> IO Vec2) -> IO Vec2
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec2
a1 ((Ptr Vec2 -> IO Vec2) -> IO Vec2)
-> (Ptr Vec2 -> IO Vec2) -> IO Vec2
forall a b. (a -> b) -> a -> b
$ \Ptr Vec2
p1 ->
(Ptr Vec2 -> IO Vec2) -> IO Vec2
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Vec2 -> IO Vec2) -> IO Vec2)
-> (Ptr Vec2 -> IO Vec2) -> IO Vec2
forall a b. (a -> b) -> a -> b
$ \Ptr Vec2
pOut -> ShapeId -> Ptr Vec2 -> Ptr Vec2 -> IO ()
c_b2Shape_GetClosestPoint ShapeId
a0 Ptr Vec2
p1 Ptr Vec2
pOut IO () -> IO Vec2 -> IO Vec2
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Vec2 -> IO Vec2
forall a. Storable a => Ptr a -> IO a
peek Ptr Vec2
pOut
applyWind
:: ShapeId
-> Vec2
-> Float
-> Float
-> Bool
-> IO ()
applyWind :: ShapeId -> Vec2 -> Float -> Float -> Bool -> IO ()
applyWind ShapeId
a0 Vec2
a1 Float
a2 Float
a3 Bool
a4 =
Vec2 -> (Ptr Vec2 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Vec2
a1 ((Ptr Vec2 -> IO ()) -> IO ()) -> (Ptr Vec2 -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Vec2
p1 ->
ShapeId -> Ptr Vec2 -> Float -> Float -> CBool -> IO ()
c_b2Shape_ApplyWind ShapeId
a0 Ptr Vec2
p1 Float
a2 Float
a3 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a4)