-- Produced by boxnd-gen; edit the generator, not this file.

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 a wheel joint
See also b2WheelJointDef for details.

Binds @b2CreateWheelJoint@.
-}
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

{- | Enable\/disable the wheel joint spring

Binds @b2WheelJoint_EnableSpring@.
-}
enableSpring
  :: JointId
  -> Bool
  -- ^ @enableSpring@
  -> 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)

{- | Is the wheel joint spring enabled?

Binds @b2WheelJoint_IsSpringEnabled@.
-}
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)

{- | Set the wheel joint stiffness in Hertz

Binds @b2WheelJoint_SetSpringHertz@.
-}
setSpringHertz
  :: JointId
  -> Float
  -- ^ @hertz@
  -> IO ()
setSpringHertz :: JointId -> Float -> IO ()
setSpringHertz JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b2WheelJoint_SetSpringHertz JointId
a0 Float
a1

{- | Get the wheel joint stiffness in Hertz

Binds @b2WheelJoint_GetSpringHertz@.
-}
getSpringHertz
  :: JointId
  -> IO Float
getSpringHertz :: JointId -> IO Float
getSpringHertz JointId
a0 =
  JointId -> IO Float
c_b2WheelJoint_GetSpringHertz JointId
a0

{- | Set the wheel joint damping ratio, non-dimensional

Binds @b2WheelJoint_SetSpringDampingRatio@.
-}
setSpringDampingRatio
  :: JointId
  -> Float
  -- ^ @dampingRatio@
  -> IO ()
setSpringDampingRatio :: JointId -> Float -> IO ()
setSpringDampingRatio JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b2WheelJoint_SetSpringDampingRatio JointId
a0 Float
a1

{- | Get the wheel joint damping ratio, non-dimensional

Binds @b2WheelJoint_GetSpringDampingRatio@.
-}
getSpringDampingRatio
  :: JointId
  -> IO Float
getSpringDampingRatio :: JointId -> IO Float
getSpringDampingRatio JointId
a0 =
  JointId -> IO Float
c_b2WheelJoint_GetSpringDampingRatio JointId
a0

{- | Enable\/disable the wheel joint limit

Binds @b2WheelJoint_EnableLimit@.
-}
enableLimit
  :: JointId
  -> Bool
  -- ^ @enableLimit@
  -> 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)

{- | Is the wheel joint limit enabled?

Binds @b2WheelJoint_IsLimitEnabled@.
-}
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)

{- | Get the wheel joint lower limit

Binds @b2WheelJoint_GetLowerLimit@.
-}
getLowerLimit
  :: JointId
  -> IO Float
getLowerLimit :: JointId -> IO Float
getLowerLimit JointId
a0 =
  JointId -> IO Float
c_b2WheelJoint_GetLowerLimit JointId
a0

{- | Get the wheel joint upper limit

Binds @b2WheelJoint_GetUpperLimit@.
-}
getUpperLimit
  :: JointId
  -> IO Float
getUpperLimit :: JointId -> IO Float
getUpperLimit JointId
a0 =
  JointId -> IO Float
c_b2WheelJoint_GetUpperLimit JointId
a0

{- | Set the wheel joint limits

Binds @b2WheelJoint_SetLimits@.
-}
setLimits
  :: JointId
  -> Float
  -- ^ @lower@
  -> Float
  -- ^ @upper@
  -> 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

{- | Enable\/disable the wheel joint motor

Binds @b2WheelJoint_EnableMotor@.
-}
enableMotor
  :: JointId
  -> Bool
  -- ^ @enableMotor@
  -> 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)

{- | Is the wheel joint motor enabled?

Binds @b2WheelJoint_IsMotorEnabled@.
-}
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)

{- | Set the wheel joint motor speed in radians per second

Binds @b2WheelJoint_SetMotorSpeed@.
-}
setMotorSpeed
  :: JointId
  -> Float
  -- ^ @motorSpeed@
  -> IO ()
setMotorSpeed :: JointId -> Float -> IO ()
setMotorSpeed JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b2WheelJoint_SetMotorSpeed JointId
a0 Float
a1

{- | Get the wheel joint motor speed in radians per second

Binds @b2WheelJoint_GetMotorSpeed@.
-}
getMotorSpeed
  :: JointId
  -> IO Float
getMotorSpeed :: JointId -> IO Float
getMotorSpeed JointId
a0 =
  JointId -> IO Float
c_b2WheelJoint_GetMotorSpeed JointId
a0

{- | Set the wheel joint maximum motor torque, usually in newton-meters

Binds @b2WheelJoint_SetMaxMotorTorque@.
-}
setMaxMotorTorque
  :: JointId
  -> Float
  -- ^ @torque@
  -> IO ()
setMaxMotorTorque :: JointId -> Float -> IO ()
setMaxMotorTorque JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b2WheelJoint_SetMaxMotorTorque JointId
a0 Float
a1

{- | Get the wheel joint maximum motor torque, usually in newton-meters

Binds @b2WheelJoint_GetMaxMotorTorque@.
-}
getMaxMotorTorque
  :: JointId
  -> IO Float
getMaxMotorTorque :: JointId -> IO Float
getMaxMotorTorque JointId
a0 =
  JointId -> IO Float
c_b2WheelJoint_GetMaxMotorTorque JointId
a0

{- | Get the wheel joint current motor torque, usually in newton-meters

Binds @b2WheelJoint_GetMotorTorque@.
-}
getMotorTorque
  :: JointId
  -> IO Float
getMotorTorque :: JointId -> IO Float
getMotorTorque JointId
a0 =
  JointId -> IO Float
c_b2WheelJoint_GetMotorTorque JointId
a0