Box2D 3.1.0
A 2D physics engine for games
Loading...
Searching...
No Matches
id.h
1// SPDX-FileCopyrightText: 2023 Erin Catto
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include "base.h"
7
8#include <stdint.h>
9
37typedef struct b2WorldId
38{
39 uint16_t index1;
40 uint16_t revision;
41} b2WorldId;
42
44typedef struct b2BodyId
45{
46 int32_t index1;
47 uint16_t world0;
48 uint16_t revision;
49} b2BodyId;
50
52typedef struct b2ShapeId
53{
54 int32_t index1;
55 uint16_t world0;
56 uint16_t revision;
57} b2ShapeId;
58
60typedef struct b2JointId
61{
62 int32_t index1;
63 uint16_t world0;
64 uint16_t revision;
65} b2JointId;
66
68typedef struct b2ChainId
69{
70 int32_t index1;
71 uint16_t world0;
72 uint16_t revision;
73} b2ChainId;
74
77static const b2WorldId b2_nullWorldId = B2_ZERO_INIT;
78static const b2BodyId b2_nullBodyId = B2_ZERO_INIT;
79static const b2ShapeId b2_nullShapeId = B2_ZERO_INIT;
80static const b2JointId b2_nullJointId = B2_ZERO_INIT;
81static const b2ChainId b2_nullChainId = B2_ZERO_INIT;
82
84#define B2_IS_NULL( id ) ( id.index1 == 0 )
85
87#define B2_IS_NON_NULL( id ) ( id.index1 != 0 )
88
90#define B2_ID_EQUALS( id1, id2 ) ( id1.index1 == id2.index1 && id1.world0 == id2.world0 && id1.revision == id2.revision )
91
Body id references a body instance. This should be treated as an opaque handle.
Definition id.h:45
Chain id references a chain instances. This should be treated as an opaque handle.
Definition id.h:69
Joint id references a joint instance. This should be treated as an opaque handle.
Definition id.h:61
Shape id references a shape instance. This should be treated as an opaque handle.
Definition id.h:53
World id references a world instance. This should be treated as an opaque handle.
Definition id.h:38