module Box2D.WheelJoint
( create
, enableSpring
, isSpringEnabled
, setSpringHertz
, getSpringHertz
, setSpringDampingRatio
, getSpringDampingRatio
, enableLimit
, isLimitEnabled
, getLowerLimit
, getUpperLimit
, setLimits
, enableMotor
, isMotorEnabled
, setMotorSpeed
, getMotorSpeed
, setMaxMotorTorque
, getMaxMotorTorque
, getMotorTorque
)
where
import Foreign
import Foreign.C.Types (CBool(..))
import Box2D.Id (JointId(..), WorldId(..))
import Box2D.Types (WheelJointDef)
foreign import ccall unsafe "b2CreateWheelJoint"
c_b2CreateWheelJoint :: WorldId -> Ptr WheelJointDef -> IO JointId
foreign import ccall unsafe "b2WheelJoint_EnableSpring"
c_b2WheelJoint_EnableSpring :: JointId -> CBool -> IO ()
foreign import ccall unsafe "b2WheelJoint_IsSpringEnabled"
c_b2WheelJoint_IsSpringEnabled :: JointId -> IO CBool
foreign import ccall unsafe "b2WheelJoint_SetSpringHertz"
c_b2WheelJoint_SetSpringHertz :: JointId -> Float -> IO ()
foreign import ccall unsafe "b2WheelJoint_GetSpringHertz"
c_b2WheelJoint_GetSpringHertz :: JointId -> IO Float
foreign import ccall unsafe "b2WheelJoint_SetSpringDampingRatio"
c_b2WheelJoint_SetSpringDampingRatio :: JointId -> Float -> IO ()
foreign import ccall unsafe "b2WheelJoint_GetSpringDampingRatio"
c_b2WheelJoint_GetSpringDampingRatio :: JointId -> IO Float
foreign import ccall unsafe "b2WheelJoint_EnableLimit"
c_b2WheelJoint_EnableLimit :: JointId -> CBool -> IO ()
foreign import ccall unsafe "b2WheelJoint_IsLimitEnabled"
c_b2WheelJoint_IsLimitEnabled :: JointId -> IO CBool
foreign import ccall unsafe "b2WheelJoint_GetLowerLimit"
c_b2WheelJoint_GetLowerLimit :: JointId -> IO Float
foreign import ccall unsafe "b2WheelJoint_GetUpperLimit"
c_b2WheelJoint_GetUpperLimit :: JointId -> IO Float
foreign import ccall unsafe "b2WheelJoint_SetLimits"
c_b2WheelJoint_SetLimits :: JointId -> Float -> Float -> IO ()
foreign import ccall unsafe "b2WheelJoint_EnableMotor"
c_b2WheelJoint_EnableMotor :: JointId -> CBool -> IO ()
foreign import ccall unsafe "b2WheelJoint_IsMotorEnabled"
c_b2WheelJoint_IsMotorEnabled :: JointId -> IO CBool
foreign import ccall unsafe "b2WheelJoint_SetMotorSpeed"
c_b2WheelJoint_SetMotorSpeed :: JointId -> Float -> IO ()
foreign import ccall unsafe "b2WheelJoint_GetMotorSpeed"
c_b2WheelJoint_GetMotorSpeed :: JointId -> IO Float
foreign import ccall unsafe "b2WheelJoint_SetMaxMotorTorque"
c_b2WheelJoint_SetMaxMotorTorque :: JointId -> Float -> IO ()
foreign import ccall unsafe "b2WheelJoint_GetMaxMotorTorque"
c_b2WheelJoint_GetMaxMotorTorque :: JointId -> IO Float
foreign import ccall unsafe "b2WheelJoint_GetMotorTorque"
c_b2WheelJoint_GetMotorTorque :: JointId -> IO Float
create
:: WorldId
-> WheelJointDef
-> IO JointId
create :: WorldId -> WheelJointDef -> IO JointId
create WorldId
a0 WheelJointDef
a1 =
WheelJointDef -> (Ptr WheelJointDef -> IO JointId) -> IO JointId
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with WheelJointDef
a1 ((Ptr WheelJointDef -> IO JointId) -> IO JointId)
-> (Ptr WheelJointDef -> IO JointId) -> IO JointId
forall a b. (a -> b) -> a -> b
$ \Ptr WheelJointDef
p1 ->
WorldId -> Ptr WheelJointDef -> IO JointId
c_b2CreateWheelJoint WorldId
a0 Ptr WheelJointDef
p1
enableSpring
:: JointId
-> Bool
-> IO ()
enableSpring :: JointId -> Bool -> IO ()
enableSpring JointId
a0 Bool
a1 =
JointId -> CBool -> IO ()
c_b2WheelJoint_EnableSpring JointId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)
isSpringEnabled
:: JointId
-> IO Bool
isSpringEnabled :: JointId -> IO Bool
isSpringEnabled JointId
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
<$> (JointId -> IO CBool
c_b2WheelJoint_IsSpringEnabled JointId
a0)
setSpringHertz
:: JointId
-> Float
-> IO ()
setSpringHertz :: JointId -> Float -> IO ()
setSpringHertz JointId
a0 Float
a1 =
JointId -> Float -> IO ()
c_b2WheelJoint_SetSpringHertz JointId
a0 Float
a1
getSpringHertz
:: JointId
-> IO Float
getSpringHertz :: JointId -> IO Float
getSpringHertz JointId
a0 =
JointId -> IO Float
c_b2WheelJoint_GetSpringHertz JointId
a0
setSpringDampingRatio
:: JointId
-> Float
-> IO ()
setSpringDampingRatio :: JointId -> Float -> IO ()
setSpringDampingRatio JointId
a0 Float
a1 =
JointId -> Float -> IO ()
c_b2WheelJoint_SetSpringDampingRatio JointId
a0 Float
a1
getSpringDampingRatio
:: JointId
-> IO Float
getSpringDampingRatio :: JointId -> IO Float
getSpringDampingRatio JointId
a0 =
JointId -> IO Float
c_b2WheelJoint_GetSpringDampingRatio JointId
a0
enableLimit
:: JointId
-> Bool
-> IO ()
enableLimit :: JointId -> Bool -> IO ()
enableLimit JointId
a0 Bool
a1 =
JointId -> CBool -> IO ()
c_b2WheelJoint_EnableLimit JointId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)
isLimitEnabled
:: JointId
-> IO Bool
isLimitEnabled :: JointId -> IO Bool
isLimitEnabled JointId
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
<$> (JointId -> IO CBool
c_b2WheelJoint_IsLimitEnabled JointId
a0)
getLowerLimit
:: JointId
-> IO Float
getLowerLimit :: JointId -> IO Float
getLowerLimit JointId
a0 =
JointId -> IO Float
c_b2WheelJoint_GetLowerLimit JointId
a0
getUpperLimit
:: JointId
-> IO Float
getUpperLimit :: JointId -> IO Float
getUpperLimit JointId
a0 =
JointId -> IO Float
c_b2WheelJoint_GetUpperLimit JointId
a0
setLimits
:: JointId
-> Float
-> Float
-> IO ()
setLimits :: JointId -> Float -> Float -> IO ()
setLimits JointId
a0 Float
a1 Float
a2 =
JointId -> Float -> Float -> IO ()
c_b2WheelJoint_SetLimits JointId
a0 Float
a1 Float
a2
enableMotor
:: JointId
-> Bool
-> IO ()
enableMotor :: JointId -> Bool -> IO ()
enableMotor JointId
a0 Bool
a1 =
JointId -> CBool -> IO ()
c_b2WheelJoint_EnableMotor JointId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)
isMotorEnabled
:: JointId
-> IO Bool
isMotorEnabled :: JointId -> IO Bool
isMotorEnabled JointId
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
<$> (JointId -> IO CBool
c_b2WheelJoint_IsMotorEnabled JointId
a0)
setMotorSpeed
:: JointId
-> Float
-> IO ()
setMotorSpeed :: JointId -> Float -> IO ()
setMotorSpeed JointId
a0 Float
a1 =
JointId -> Float -> IO ()
c_b2WheelJoint_SetMotorSpeed JointId
a0 Float
a1
getMotorSpeed
:: JointId
-> IO Float
getMotorSpeed :: JointId -> IO Float
getMotorSpeed JointId
a0 =
JointId -> IO Float
c_b2WheelJoint_GetMotorSpeed JointId
a0
setMaxMotorTorque
:: JointId
-> Float
-> IO ()
setMaxMotorTorque :: JointId -> Float -> IO ()
setMaxMotorTorque JointId
a0 Float
a1 =
JointId -> Float -> IO ()
c_b2WheelJoint_SetMaxMotorTorque JointId
a0 Float
a1
getMaxMotorTorque
:: JointId
-> IO Float
getMaxMotorTorque :: JointId -> IO Float
getMaxMotorTorque JointId
a0 =
JointId -> IO Float
c_b2WheelJoint_GetMaxMotorTorque JointId
a0
getMotorTorque
:: JointId
-> IO Float
getMotorTorque :: JointId -> IO Float
getMotorTorque JointId
a0 =
JointId -> IO Float
c_b2WheelJoint_GetMotorTorque JointId
a0