| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Box2D.Events
Description
Reading the per-step event buffers as ordinary Haskell values.
Box2D exposes events as C-owned arrays that live only between one
step and the next. The generated World.get*Events primitives
hand back the raw { pointer, count } buffer struct; this module copies the
elements out (one memcpy each) into Haskell-owned storable vectors so
they outlive the step. For zero-copy step-scoped views, wrap the raw
buffers with unsafeViewVector. Call it after stepping.
This is the hand-written counterpart to the generated bindings: the array marshalling (roadmap phase 5) is not something the generator emits.
Synopsis
- bodyMoveEvents :: WorldId -> IO (Vector BodyMoveEvent)
- sensorBeginTouchEvents :: WorldId -> IO (Vector SensorBeginTouchEvent)
- sensorEndTouchEvents :: WorldId -> IO (Vector SensorEndTouchEvent)
- contactBeginTouchEvents :: WorldId -> IO (Vector ContactBeginTouchEvent)
- contactEndTouchEvents :: WorldId -> IO (Vector ContactEndTouchEvent)
- contactHitEvents :: WorldId -> IO (Vector ContactHitEvent)
- jointEvents :: WorldId -> IO (Vector JointEvent)
Documentation
bodyMoveEvents :: WorldId -> IO (Vector BodyMoveEvent) Source #
The bodies that moved during the last step, copied out of the
world-owned buffer. Valid to call any time, but only reflects the most recent
step.
sensorBeginTouchEvents :: WorldId -> IO (Vector SensorBeginTouchEvent) Source #
The shapes that started overlapping a sensor during the last step.
sensorEndTouchEvents :: WorldId -> IO (Vector SensorEndTouchEvent) Source #
The shapes that stopped overlapping a sensor during the last step.
contactBeginTouchEvents :: WorldId -> IO (Vector ContactBeginTouchEvent) Source #
The shape pairs that began touching during the last step. Requires
shapeDefEnableContactEvents on both shapes.
contactEndTouchEvents :: WorldId -> IO (Vector ContactEndTouchEvent) Source #
The shape pairs that stopped touching during the last step.
contactHitEvents :: WorldId -> IO (Vector ContactHitEvent) Source #
The impacts faster than worldDefHitEventThreshold during the last step.
Requires shapeDefEnableHitEvents.
jointEvents :: WorldId -> IO (Vector JointEvent) Source #
The joints that exceeded their force/torque event threshold during the
last step. Requires Box2D.Joint.setForceThreshold / torque threshold and
per-joint event enabling.