Box2D 3.0.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 "box2d/base.h"
7
8#include <stdint.h>
9
36typedef struct b2WorldId
37{
38 uint16_t index1;
39 uint16_t revision;
40} b2WorldId;
41
43typedef struct b2BodyId
44{
45 int32_t index1;
46 uint16_t world0;
47 uint16_t revision;
48} b2BodyId;
49
51typedef struct b2ShapeId
52{
53 int32_t index1;
54 uint16_t world0;
55 uint16_t revision;
56} b2ShapeId;
57
59typedef struct b2JointId
60{
61 int32_t index1;
62 uint16_t world0;
63 uint16_t revision;
64} b2JointId;
65
67typedef struct b2ChainId
68{
69 int32_t index1;
70 uint16_t world0;
71 uint16_t revision;
72} b2ChainId;
73
76static const b2WorldId b2_nullWorldId = B2_ZERO_INIT;
77static const b2BodyId b2_nullBodyId = B2_ZERO_INIT;
78static const b2ShapeId b2_nullShapeId = B2_ZERO_INIT;
79static const b2JointId b2_nullJointId = B2_ZERO_INIT;
80static const b2ChainId b2_nullChainId = B2_ZERO_INIT;
81
83#define B2_IS_NULL(id) (id.index1 == 0)
84
86#define B2_IS_NON_NULL(id) (id.index1 != 0)
87
89#define B2_ID_EQUALS(id1, id2) (id1.index1 == id2.index1 && id1.world0 == id2.world0 && id1.revision == id2.revision)
90
Body id references a body instance. This should be treated as an opaque handle.
Definition id.h:44
Chain id references a chain instances. This should be treated as an opaque handle.
Definition id.h:68
Joint id references a joint instance. This should be treated as an opaque handle.
Definition id.h:60
Shape id references a shape instance. This should be treated as an opaque handle.
Definition id.h:52
World id references a world instance. This should be treated as an opaque handle.
Definition id.h:37