module Box2D.RevoluteJoint
( create
, enableSpring
, isSpringEnabled
, setSpringHertz
, getSpringHertz
, setSpringDampingRatio
, getSpringDampingRatio
, setTargetAngle
, getTargetAngle
, getAngle
, enableLimit
, isLimitEnabled
, getLowerLimit
, getUpperLimit
, setLimits
, enableMotor
, isMotorEnabled
, setMotorSpeed
, getMotorSpeed
, getMotorTorque
, setMaxMotorTorque
, getMaxMotorTorque
)
where
import Foreign
import Foreign.C.Types (CBool(..))
import Box2D.Id (JointId(..), WorldId(..))
import Box2D.Types (RevoluteJointDef)
foreign import ccall unsafe "b2CreateRevoluteJoint"
c_b2CreateRevoluteJoint :: WorldId -> Ptr RevoluteJointDef -> IO JointId
foreign import ccall unsafe "b2RevoluteJoint_EnableSpring"
c_b2RevoluteJoint_EnableSpring :: JointId -> CBool -> IO ()
foreign import ccall unsafe "b2RevoluteJoint_IsSpringEnabled"
c_b2RevoluteJoint_IsSpringEnabled :: JointId -> IO CBool
foreign import ccall unsafe "b2RevoluteJoint_SetSpringHertz"
c_b2RevoluteJoint_SetSpringHertz :: JointId -> Float -> IO ()
foreign import ccall unsafe "b2RevoluteJoint_GetSpringHertz"
c_b2RevoluteJoint_GetSpringHertz :: JointId -> IO Float
foreign import ccall unsafe "b2RevoluteJoint_SetSpringDampingRatio"
c_b2RevoluteJoint_SetSpringDampingRatio :: JointId -> Float -> IO ()
foreign import ccall unsafe "b2RevoluteJoint_GetSpringDampingRatio"
c_b2RevoluteJoint_GetSpringDampingRatio :: JointId -> IO Float
foreign import ccall unsafe "b2RevoluteJoint_SetTargetAngle"
c_b2RevoluteJoint_SetTargetAngle :: JointId -> Float -> IO ()
foreign import ccall unsafe "b2RevoluteJoint_GetTargetAngle"
c_b2RevoluteJoint_GetTargetAngle :: JointId -> IO Float
foreign import ccall unsafe "b2RevoluteJoint_GetAngle"
c_b2RevoluteJoint_GetAngle :: JointId -> IO Float
foreign import ccall unsafe "b2RevoluteJoint_EnableLimit"
c_b2RevoluteJoint_EnableLimit :: JointId -> CBool -> IO ()
foreign import ccall unsafe "b2RevoluteJoint_IsLimitEnabled"
c_b2RevoluteJoint_IsLimitEnabled :: JointId -> IO CBool
foreign import ccall unsafe "b2RevoluteJoint_GetLowerLimit"
c_b2RevoluteJoint_GetLowerLimit :: JointId -> IO Float
foreign import ccall unsafe "b2RevoluteJoint_GetUpperLimit"
c_b2RevoluteJoint_GetUpperLimit :: JointId -> IO Float
foreign import ccall unsafe "b2RevoluteJoint_SetLimits"
c_b2RevoluteJoint_SetLimits :: JointId -> Float -> Float -> IO ()
foreign import ccall unsafe "b2RevoluteJoint_EnableMotor"
c_b2RevoluteJoint_EnableMotor :: JointId -> CBool -> IO ()
foreign import ccall unsafe "b2RevoluteJoint_IsMotorEnabled"
c_b2RevoluteJoint_IsMotorEnabled :: JointId -> IO CBool
foreign import ccall unsafe "b2RevoluteJoint_SetMotorSpeed"
c_b2RevoluteJoint_SetMotorSpeed :: JointId -> Float -> IO ()
foreign import ccall unsafe "b2RevoluteJoint_GetMotorSpeed"
c_b2RevoluteJoint_GetMotorSpeed :: JointId -> IO Float
foreign import ccall unsafe "b2RevoluteJoint_GetMotorTorque"
c_b2RevoluteJoint_GetMotorTorque :: JointId -> IO Float
foreign import ccall unsafe "b2RevoluteJoint_SetMaxMotorTorque"
c_b2RevoluteJoint_SetMaxMotorTorque :: JointId -> Float -> IO ()
foreign import ccall unsafe "b2RevoluteJoint_GetMaxMotorTorque"
c_b2RevoluteJoint_GetMaxMotorTorque :: JointId -> IO Float
create
:: WorldId
-> RevoluteJointDef
-> IO JointId
create :: WorldId -> RevoluteJointDef -> IO JointId
create WorldId
a0 RevoluteJointDef
a1 =
RevoluteJointDef
-> (Ptr RevoluteJointDef -> IO JointId) -> IO JointId
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with RevoluteJointDef
a1 ((Ptr RevoluteJointDef -> IO JointId) -> IO JointId)
-> (Ptr RevoluteJointDef -> IO JointId) -> IO JointId
forall a b. (a -> b) -> a -> b
$ \Ptr RevoluteJointDef
p1 ->
WorldId -> Ptr RevoluteJointDef -> IO JointId
c_b2CreateRevoluteJoint WorldId
a0 Ptr RevoluteJointDef
p1
enableSpring
:: JointId
-> Bool
-> IO ()
enableSpring :: JointId -> Bool -> IO ()
enableSpring JointId
a0 Bool
a1 =
JointId -> CBool -> IO ()
c_b2RevoluteJoint_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_b2RevoluteJoint_IsSpringEnabled JointId
a0)
setSpringHertz
:: JointId
-> Float
-> IO ()
setSpringHertz :: JointId -> Float -> IO ()
setSpringHertz JointId
a0 Float
a1 =
JointId -> Float -> IO ()
c_b2RevoluteJoint_SetSpringHertz JointId
a0 Float
a1
getSpringHertz
:: JointId
-> IO Float
getSpringHertz :: JointId -> IO Float
getSpringHertz JointId
a0 =
JointId -> IO Float
c_b2RevoluteJoint_GetSpringHertz JointId
a0
setSpringDampingRatio
:: JointId
-> Float
-> IO ()
setSpringDampingRatio :: JointId -> Float -> IO ()
setSpringDampingRatio JointId
a0 Float
a1 =
JointId -> Float -> IO ()
c_b2RevoluteJoint_SetSpringDampingRatio JointId
a0 Float
a1
getSpringDampingRatio
:: JointId
-> IO Float
getSpringDampingRatio :: JointId -> IO Float
getSpringDampingRatio JointId
a0 =
JointId -> IO Float
c_b2RevoluteJoint_GetSpringDampingRatio JointId
a0
setTargetAngle
:: JointId
-> Float
-> IO ()
setTargetAngle :: JointId -> Float -> IO ()
setTargetAngle JointId
a0 Float
a1 =
JointId -> Float -> IO ()
c_b2RevoluteJoint_SetTargetAngle JointId
a0 Float
a1
getTargetAngle
:: JointId
-> IO Float
getTargetAngle :: JointId -> IO Float
getTargetAngle JointId
a0 =
JointId -> IO Float
c_b2RevoluteJoint_GetTargetAngle JointId
a0
getAngle
:: JointId
-> IO Float
getAngle :: JointId -> IO Float
getAngle JointId
a0 =
JointId -> IO Float
c_b2RevoluteJoint_GetAngle JointId
a0
enableLimit
:: JointId
-> Bool
-> IO ()
enableLimit :: JointId -> Bool -> IO ()
enableLimit JointId
a0 Bool
a1 =
JointId -> CBool -> IO ()
c_b2RevoluteJoint_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_b2RevoluteJoint_IsLimitEnabled JointId
a0)
getLowerLimit
:: JointId
-> IO Float
getLowerLimit :: JointId -> IO Float
getLowerLimit JointId
a0 =
JointId -> IO Float
c_b2RevoluteJoint_GetLowerLimit JointId
a0
getUpperLimit
:: JointId
-> IO Float
getUpperLimit :: JointId -> IO Float
getUpperLimit JointId
a0 =
JointId -> IO Float
c_b2RevoluteJoint_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_b2RevoluteJoint_SetLimits JointId
a0 Float
a1 Float
a2
enableMotor
:: JointId
-> Bool
-> IO ()
enableMotor :: JointId -> Bool -> IO ()
enableMotor JointId
a0 Bool
a1 =
JointId -> CBool -> IO ()
c_b2RevoluteJoint_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_b2RevoluteJoint_IsMotorEnabled JointId
a0)
setMotorSpeed
:: JointId
-> Float
-> IO ()
setMotorSpeed :: JointId -> Float -> IO ()
setMotorSpeed JointId
a0 Float
a1 =
JointId -> Float -> IO ()
c_b2RevoluteJoint_SetMotorSpeed JointId
a0 Float
a1
getMotorSpeed
:: JointId
-> IO Float
getMotorSpeed :: JointId -> IO Float
getMotorSpeed JointId
a0 =
JointId -> IO Float
c_b2RevoluteJoint_GetMotorSpeed JointId
a0
getMotorTorque
:: JointId
-> IO Float
getMotorTorque :: JointId -> IO Float
getMotorTorque JointId
a0 =
JointId -> IO Float
c_b2RevoluteJoint_GetMotorTorque JointId
a0
setMaxMotorTorque
:: JointId
-> Float
-> IO ()
setMaxMotorTorque :: JointId -> Float -> IO ()
setMaxMotorTorque JointId
a0 Float
a1 =
JointId -> Float -> IO ()
c_b2RevoluteJoint_SetMaxMotorTorque JointId
a0 Float
a1
getMaxMotorTorque
:: JointId
-> IO Float
getMaxMotorTorque :: JointId -> IO Float
getMaxMotorTorque JointId
a0 =
JointId -> IO Float
c_b2RevoluteJoint_GetMaxMotorTorque JointId
a0