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

module Box2D.MotorJoint
  ( create
  , setLinearVelocity
  , getLinearVelocity
  , getLinearVelocityInto
  , setAngularVelocity
  , getAngularVelocity
  , setMaxVelocityForce
  , getMaxVelocityForce
  , setMaxVelocityTorque
  , getMaxVelocityTorque
  , setLinearHertz
  , getLinearHertz
  , setLinearDampingRatio
  , getLinearDampingRatio
  , setAngularHertz
  , getAngularHertz
  , setAngularDampingRatio
  , getAngularDampingRatio
  , setMaxSpringForce
  , getMaxSpringForce
  , setMaxSpringTorque
  , getMaxSpringTorque
  )

  where

import Foreign
import Box2D.Id (JointId(..), WorldId(..))
import Box2D.MathTypes (Vec2)
import Box2D.Types (MotorJointDef)

foreign import ccall unsafe "b2CreateMotorJoint"
  c_b2CreateMotorJoint :: WorldId -> Ptr MotorJointDef -> IO JointId

foreign import ccall unsafe "hsg_b2MotorJoint_SetLinearVelocity"
  c_b2MotorJoint_SetLinearVelocity :: JointId -> Ptr Vec2 -> IO ()

foreign import ccall unsafe "hsg_b2MotorJoint_GetLinearVelocity"
  c_b2MotorJoint_GetLinearVelocity :: JointId -> Ptr Vec2 -> IO ()

foreign import ccall unsafe "b2MotorJoint_SetAngularVelocity"
  c_b2MotorJoint_SetAngularVelocity :: JointId -> Float -> IO ()

foreign import ccall unsafe "b2MotorJoint_GetAngularVelocity"
  c_b2MotorJoint_GetAngularVelocity :: JointId -> IO Float

foreign import ccall unsafe "b2MotorJoint_SetMaxVelocityForce"
  c_b2MotorJoint_SetMaxVelocityForce :: JointId -> Float -> IO ()

foreign import ccall unsafe "b2MotorJoint_GetMaxVelocityForce"
  c_b2MotorJoint_GetMaxVelocityForce :: JointId -> IO Float

foreign import ccall unsafe "b2MotorJoint_SetMaxVelocityTorque"
  c_b2MotorJoint_SetMaxVelocityTorque :: JointId -> Float -> IO ()

foreign import ccall unsafe "b2MotorJoint_GetMaxVelocityTorque"
  c_b2MotorJoint_GetMaxVelocityTorque :: JointId -> IO Float

foreign import ccall unsafe "b2MotorJoint_SetLinearHertz"
  c_b2MotorJoint_SetLinearHertz :: JointId -> Float -> IO ()

foreign import ccall unsafe "b2MotorJoint_GetLinearHertz"
  c_b2MotorJoint_GetLinearHertz :: JointId -> IO Float

foreign import ccall unsafe "b2MotorJoint_SetLinearDampingRatio"
  c_b2MotorJoint_SetLinearDampingRatio :: JointId -> Float -> IO ()

foreign import ccall unsafe "b2MotorJoint_GetLinearDampingRatio"
  c_b2MotorJoint_GetLinearDampingRatio :: JointId -> IO Float

foreign import ccall unsafe "b2MotorJoint_SetAngularHertz"
  c_b2MotorJoint_SetAngularHertz :: JointId -> Float -> IO ()

foreign import ccall unsafe "b2MotorJoint_GetAngularHertz"
  c_b2MotorJoint_GetAngularHertz :: JointId -> IO Float

foreign import ccall unsafe "b2MotorJoint_SetAngularDampingRatio"
  c_b2MotorJoint_SetAngularDampingRatio :: JointId -> Float -> IO ()

foreign import ccall unsafe "b2MotorJoint_GetAngularDampingRatio"
  c_b2MotorJoint_GetAngularDampingRatio :: JointId -> IO Float

foreign import ccall unsafe "b2MotorJoint_SetMaxSpringForce"
  c_b2MotorJoint_SetMaxSpringForce :: JointId -> Float -> IO ()

foreign import ccall unsafe "b2MotorJoint_GetMaxSpringForce"
  c_b2MotorJoint_GetMaxSpringForce :: JointId -> IO Float

foreign import ccall unsafe "b2MotorJoint_SetMaxSpringTorque"
  c_b2MotorJoint_SetMaxSpringTorque :: JointId -> Float -> IO ()

foreign import ccall unsafe "b2MotorJoint_GetMaxSpringTorque"
  c_b2MotorJoint_GetMaxSpringTorque :: JointId -> IO Float

{- | Create a motor joint
See also b2MotorJointDef for details.

Binds @b2CreateMotorJoint@.
-}
create
  :: WorldId
  -> MotorJointDef
  -> IO JointId
create :: WorldId -> MotorJointDef -> IO JointId
create WorldId
a0 MotorJointDef
a1 =
  MotorJointDef -> (Ptr MotorJointDef -> IO JointId) -> IO JointId
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with MotorJointDef
a1 ((Ptr MotorJointDef -> IO JointId) -> IO JointId)
-> (Ptr MotorJointDef -> IO JointId) -> IO JointId
forall a b. (a -> b) -> a -> b
$ \Ptr MotorJointDef
p1 ->
  WorldId -> Ptr MotorJointDef -> IO JointId
c_b2CreateMotorJoint WorldId
a0 Ptr MotorJointDef
p1

{- | Set the desired relative linear velocity in meters per second

Binds @b2MotorJoint_SetLinearVelocity@.
-}
setLinearVelocity
  :: JointId
  -> Vec2
  -- ^ @velocity@
  -> IO ()
setLinearVelocity :: JointId -> Vec2 -> IO ()
setLinearVelocity JointId
a0 Vec2
a1 =
  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 ->
  JointId -> Ptr Vec2 -> IO ()
c_b2MotorJoint_SetLinearVelocity JointId
a0 Ptr Vec2
p1

{- | Get the desired relative linear velocity in meters per second

Binds @b2MotorJoint_GetLinearVelocity@.
-}
getLinearVelocity
  :: JointId
  -> IO Vec2
getLinearVelocity :: JointId -> IO Vec2
getLinearVelocity JointId
a0 =
  (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 -> JointId -> Ptr Vec2 -> IO ()
c_b2MotorJoint_GetLinearVelocity JointId
a0 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

-- | Like 'getLinearVelocity', but the result is written into a caller-supplied buffer.
getLinearVelocityInto
  :: JointId
  -> Ptr Vec2
  -- ^ Result buffer.
  -> IO ()
getLinearVelocityInto :: JointId -> Ptr Vec2 -> IO ()
getLinearVelocityInto JointId
a0 Ptr Vec2
out =
  JointId -> Ptr Vec2 -> IO ()
c_b2MotorJoint_GetLinearVelocity JointId
a0 Ptr Vec2
out

{- | Set the desired relative angular velocity in radians per second

Binds @b2MotorJoint_SetAngularVelocity@.
-}
setAngularVelocity
  :: JointId
  -> Float
  -- ^ @velocity@
  -> IO ()
setAngularVelocity :: JointId -> Float -> IO ()
setAngularVelocity JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b2MotorJoint_SetAngularVelocity JointId
a0 Float
a1

{- | Get the desired relative angular velocity in radians per second

Binds @b2MotorJoint_GetAngularVelocity@.
-}
getAngularVelocity
  :: JointId
  -> IO Float
getAngularVelocity :: JointId -> IO Float
getAngularVelocity JointId
a0 =
  JointId -> IO Float
c_b2MotorJoint_GetAngularVelocity JointId
a0

{- | Set the motor joint maximum force, usually in newtons

Binds @b2MotorJoint_SetMaxVelocityForce@.
-}
setMaxVelocityForce
  :: JointId
  -> Float
  -- ^ @maxForce@
  -> IO ()
setMaxVelocityForce :: JointId -> Float -> IO ()
setMaxVelocityForce JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b2MotorJoint_SetMaxVelocityForce JointId
a0 Float
a1

{- | Get the motor joint maximum force, usually in newtons

Binds @b2MotorJoint_GetMaxVelocityForce@.
-}
getMaxVelocityForce
  :: JointId
  -> IO Float
getMaxVelocityForce :: JointId -> IO Float
getMaxVelocityForce JointId
a0 =
  JointId -> IO Float
c_b2MotorJoint_GetMaxVelocityForce JointId
a0

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

Binds @b2MotorJoint_SetMaxVelocityTorque@.
-}
setMaxVelocityTorque
  :: JointId
  -> Float
  -- ^ @maxTorque@
  -> IO ()
setMaxVelocityTorque :: JointId -> Float -> IO ()
setMaxVelocityTorque JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b2MotorJoint_SetMaxVelocityTorque JointId
a0 Float
a1

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

Binds @b2MotorJoint_GetMaxVelocityTorque@.
-}
getMaxVelocityTorque
  :: JointId
  -> IO Float
getMaxVelocityTorque :: JointId -> IO Float
getMaxVelocityTorque JointId
a0 =
  JointId -> IO Float
c_b2MotorJoint_GetMaxVelocityTorque JointId
a0

{- | Set the spring linear hertz stiffness

Binds @b2MotorJoint_SetLinearHertz@.
-}
setLinearHertz
  :: JointId
  -> Float
  -- ^ @hertz@
  -> IO ()
setLinearHertz :: JointId -> Float -> IO ()
setLinearHertz JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b2MotorJoint_SetLinearHertz JointId
a0 Float
a1

{- | Get the spring linear hertz stiffness

Binds @b2MotorJoint_GetLinearHertz@.
-}
getLinearHertz
  :: JointId
  -> IO Float
getLinearHertz :: JointId -> IO Float
getLinearHertz JointId
a0 =
  JointId -> IO Float
c_b2MotorJoint_GetLinearHertz JointId
a0

{- | Set the spring linear damping ratio. Use 1.0 for critical damping.

Binds @b2MotorJoint_SetLinearDampingRatio@.
-}
setLinearDampingRatio
  :: JointId
  -> Float
  -- ^ @damping@
  -> IO ()
setLinearDampingRatio :: JointId -> Float -> IO ()
setLinearDampingRatio JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b2MotorJoint_SetLinearDampingRatio JointId
a0 Float
a1

{- | Get the spring linear damping ratio.

Binds @b2MotorJoint_GetLinearDampingRatio@.
-}
getLinearDampingRatio
  :: JointId
  -> IO Float
getLinearDampingRatio :: JointId -> IO Float
getLinearDampingRatio JointId
a0 =
  JointId -> IO Float
c_b2MotorJoint_GetLinearDampingRatio JointId
a0

{- | Set the spring angular hertz stiffness

Binds @b2MotorJoint_SetAngularHertz@.
-}
setAngularHertz
  :: JointId
  -> Float
  -- ^ @hertz@
  -> IO ()
setAngularHertz :: JointId -> Float -> IO ()
setAngularHertz JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b2MotorJoint_SetAngularHertz JointId
a0 Float
a1

{- | Get the spring angular hertz stiffness

Binds @b2MotorJoint_GetAngularHertz@.
-}
getAngularHertz
  :: JointId
  -> IO Float
getAngularHertz :: JointId -> IO Float
getAngularHertz JointId
a0 =
  JointId -> IO Float
c_b2MotorJoint_GetAngularHertz JointId
a0

{- | Set the spring angular damping ratio. Use 1.0 for critical damping.

Binds @b2MotorJoint_SetAngularDampingRatio@.
-}
setAngularDampingRatio
  :: JointId
  -> Float
  -- ^ @damping@
  -> IO ()
setAngularDampingRatio :: JointId -> Float -> IO ()
setAngularDampingRatio JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b2MotorJoint_SetAngularDampingRatio JointId
a0 Float
a1

{- | Get the spring angular damping ratio.

Binds @b2MotorJoint_GetAngularDampingRatio@.
-}
getAngularDampingRatio
  :: JointId
  -> IO Float
getAngularDampingRatio :: JointId -> IO Float
getAngularDampingRatio JointId
a0 =
  JointId -> IO Float
c_b2MotorJoint_GetAngularDampingRatio JointId
a0

{- | Set the maximum spring force in newtons.

Binds @b2MotorJoint_SetMaxSpringForce@.
-}
setMaxSpringForce
  :: JointId
  -> Float
  -- ^ @maxForce@
  -> IO ()
setMaxSpringForce :: JointId -> Float -> IO ()
setMaxSpringForce JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b2MotorJoint_SetMaxSpringForce JointId
a0 Float
a1

{- | Get the maximum spring force in newtons.

Binds @b2MotorJoint_GetMaxSpringForce@.
-}
getMaxSpringForce
  :: JointId
  -> IO Float
getMaxSpringForce :: JointId -> IO Float
getMaxSpringForce JointId
a0 =
  JointId -> IO Float
c_b2MotorJoint_GetMaxSpringForce JointId
a0

{- | Set the maximum spring torque in newtons * meters

Binds @b2MotorJoint_SetMaxSpringTorque@.
-}
setMaxSpringTorque
  :: JointId
  -> Float
  -- ^ @maxTorque@
  -> IO ()
setMaxSpringTorque :: JointId -> Float -> IO ()
setMaxSpringTorque JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b2MotorJoint_SetMaxSpringTorque JointId
a0 Float
a1

{- | Get the maximum spring torque in newtons * meters

Binds @b2MotorJoint_GetMaxSpringTorque@.
-}
getMaxSpringTorque
  :: JointId
  -> IO Float
getMaxSpringTorque :: JointId -> IO Float
getMaxSpringTorque JointId
a0 =
  JointId -> IO Float
c_b2MotorJoint_GetMaxSpringTorque JointId
a0