| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Box2D.Id
Description
Low-level bindings to box2d/id.h: opaque handles to Box2D objects.
The C API passes these as integer-only structs of at most 8 bytes by value.
On the 64-bit ABIs this package supports (x86-64 SysV and Win64, AArch64)
such a struct travels in a general-purpose register exactly like a
uint32_t/uint64_t, so the handles are newtypes over words and cross the
FFI directly, with no shim. The payload is the raw struct bytes and carries
no stable meaning; the constructors are exported only so foreign imports can
see through the newtypes. A zero word is the null id, which is also what
zero-initialisation produces on the C side. Struct sizes are pinned by
_Static_asserts in cbits/box2d_shim.c.
ContactId is 12 bytes and does not fit a word, so it keeps a struct-shaped
representation; nothing passes it by value yet.
Synopsis
- newtype WorldId = WorldId Word32
- newtype BodyId = BodyId Word64
- newtype ShapeId = ShapeId Word64
- newtype ChainId = ChainId Word64
- newtype JointId = JointId Word64
- data ContactId = ContactId Int32 Word16 Word32
- nullWorldId :: WorldId
- nullBodyId :: BodyId
- nullShapeId :: ShapeId
- nullChainId :: ChainId
- nullJointId :: JointId
- nullContactId :: ContactId
Documentation
Handle to a world instance.
Instances
| Storable WorldId Source # | |
| Show WorldId Source # | |
| Eq WorldId Source # | |
Handle to a body instance.
Instances
| HasUserData BodyId Source # | |
Defined in Box2D.UserData | |
| Storable BodyId Source # | |
| Show BodyId Source # | |
| Eq BodyId Source # | |
Handle to a shape instance.
Instances
| HasUserData ShapeId Source # | |
Defined in Box2D.UserData | |
| Storable ShapeId Source # | |
| Show ShapeId Source # | |
| Eq ShapeId Source # | |
Handle to a chain instance.
Instances
| Storable ChainId Source # | |
| Show ChainId Source # | |
| Eq ChainId Source # | |
Handle to a joint instance.
Instances
| HasUserData JointId Source # | |
Defined in Box2D.UserData | |
| Storable JointId Source # | |
| Show JointId Source # | |
| Eq JointId Source # | |
Handle to a contact instance.
Instances
| Storable ContactId Source # | |
Defined in Box2D.Id | |
| Show ContactId Source # | |
| Eq ContactId Source # | |
nullBodyId :: BodyId Source #