Chipmunk2D Pro API Reference
7.0.1
Main Page
Modules
Classes
Files
File List
All
Classes
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Groups
Pages
include
chipmunk
cpBody.h
1
/* Copyright (c) 2013 Scott Lembcke and Howling Moon Software
2
*
3
* Permission is hereby granted, free of charge, to any person obtaining a copy
4
* of this software and associated documentation files (the "Software"), to deal
5
* in the Software without restriction, including without limitation the rights
6
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
* copies of the Software, and to permit persons to whom the Software is
8
* furnished to do so, subject to the following conditions:
9
*
10
* The above copyright notice and this permission notice shall be included in
11
* all copies or substantial portions of the Software.
12
*
13
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
* SOFTWARE.
20
*/
21
27
28
typedef
enum
cpBodyType
{
31
CP_BODY_TYPE_DYNAMIC
,
36
CP_BODY_TYPE_KINEMATIC
,
40
CP_BODY_TYPE_STATIC
,
41
}
cpBodyType
;
42
44
typedef
void (*
cpBodyVelocityFunc
)(
cpBody
*body,
cpVect
gravity,
cpFloat
damping,
cpFloat
dt);
46
typedef
void (*
cpBodyPositionFunc
)(
cpBody
*body,
cpFloat
dt);
47
49
CP_EXPORT
cpBody
*
cpBodyAlloc
(
void
);
51
CP_EXPORT
cpBody
*
cpBodyInit
(
cpBody
*body,
cpFloat
mass,
cpFloat
moment);
53
CP_EXPORT
cpBody
*
cpBodyNew
(
cpFloat
mass,
cpFloat
moment);
54
56
CP_EXPORT
cpBody
*
cpBodyNewKinematic
(
void
);
58
CP_EXPORT
cpBody
*
cpBodyNewStatic
(
void
);
59
61
CP_EXPORT
void
cpBodyDestroy
(
cpBody
*body);
63
CP_EXPORT
void
cpBodyFree
(
cpBody
*body);
64
65
// Defined in cpSpace.c
67
CP_EXPORT
void
cpBodyActivate
(
cpBody
*body);
69
CP_EXPORT
void
cpBodyActivateStatic
(
cpBody
*body,
cpShape
*filter);
70
72
CP_EXPORT
void
cpBodySleep
(
cpBody
*body);
74
CP_EXPORT
void
cpBodySleepWithGroup
(
cpBody
*body,
cpBody
*group);
75
77
CP_EXPORT
cpBool
cpBodyIsSleeping
(
const
cpBody
*body);
78
80
CP_EXPORT
cpBodyType
cpBodyGetType
(
cpBody
*body);
82
CP_EXPORT
void
cpBodySetType
(
cpBody
*body,
cpBodyType
type);
83
85
CP_EXPORT
cpSpace
*
cpBodyGetSpace
(
const
cpBody
*body);
86
88
CP_EXPORT
cpFloat
cpBodyGetMass
(
const
cpBody
*body);
90
CP_EXPORT
void
cpBodySetMass
(
cpBody
*body,
cpFloat
m);
91
93
CP_EXPORT
cpFloat
cpBodyGetMoment
(
const
cpBody
*body);
95
CP_EXPORT
void
cpBodySetMoment
(
cpBody
*body,
cpFloat
i);
96
98
CP_EXPORT
cpVect
cpBodyGetPosition
(
const
cpBody
*body);
100
CP_EXPORT
void
cpBodySetPosition
(
cpBody
*body,
cpVect
pos);
101
103
CP_EXPORT
cpVect
cpBodyGetCenterOfGravity
(
const
cpBody
*body);
105
CP_EXPORT
void
cpBodySetCenterOfGravity
(
cpBody
*body,
cpVect
cog);
106
108
CP_EXPORT
cpVect
cpBodyGetVelocity
(
const
cpBody
*body);
110
CP_EXPORT
void
cpBodySetVelocity
(
cpBody
*body,
cpVect
velocity);
111
113
CP_EXPORT
cpVect
cpBodyGetForce
(
const
cpBody
*body);
115
CP_EXPORT
void
cpBodySetForce
(
cpBody
*body,
cpVect
force);
116
118
CP_EXPORT
cpFloat
cpBodyGetAngle
(
const
cpBody
*body);
120
CP_EXPORT
void
cpBodySetAngle
(
cpBody
*body,
cpFloat
a);
121
123
CP_EXPORT
cpFloat
cpBodyGetAngularVelocity
(
const
cpBody
*body);
125
CP_EXPORT
void
cpBodySetAngularVelocity
(
cpBody
*body,
cpFloat
angularVelocity);
126
128
CP_EXPORT
cpFloat
cpBodyGetTorque
(
const
cpBody
*body);
130
CP_EXPORT
void
cpBodySetTorque
(
cpBody
*body,
cpFloat
torque);
131
133
CP_EXPORT
cpVect
cpBodyGetRotation
(
const
cpBody
*body);
134
136
CP_EXPORT
cpDataPointer
cpBodyGetUserData
(
const
cpBody
*body);
138
CP_EXPORT
void
cpBodySetUserData
(
cpBody
*body,
cpDataPointer
userData);
139
141
CP_EXPORT
void
cpBodySetVelocityUpdateFunc
(
cpBody
*body,
cpBodyVelocityFunc
velocityFunc);
144
CP_EXPORT
void
cpBodySetPositionUpdateFunc
(
cpBody
*body,
cpBodyPositionFunc
positionFunc);
145
147
CP_EXPORT
void
cpBodyUpdateVelocity
(
cpBody
*body,
cpVect
gravity,
cpFloat
damping,
cpFloat
dt);
149
CP_EXPORT
void
cpBodyUpdatePosition
(
cpBody
*body,
cpFloat
dt);
150
152
CP_EXPORT
cpVect
cpBodyLocalToWorld
(
const
cpBody
*body,
const
cpVect
point);
154
CP_EXPORT
cpVect
cpBodyWorldToLocal
(
const
cpBody
*body,
const
cpVect
point);
155
157
CP_EXPORT
void
cpBodyApplyForceAtWorldPoint
(
cpBody
*body,
cpVect
force,
cpVect
point);
159
CP_EXPORT
void
cpBodyApplyForceAtLocalPoint
(
cpBody
*body,
cpVect
force,
cpVect
point);
160
162
CP_EXPORT
void
cpBodyApplyImpulseAtWorldPoint
(
cpBody
*body,
cpVect
impulse,
cpVect
point);
164
CP_EXPORT
void
cpBodyApplyImpulseAtLocalPoint
(
cpBody
*body,
cpVect
impulse,
cpVect
point);
165
167
CP_EXPORT
cpVect
cpBodyGetVelocityAtWorldPoint
(
const
cpBody
*body,
cpVect
point);
169
CP_EXPORT
cpVect
cpBodyGetVelocityAtLocalPoint
(
const
cpBody
*body,
cpVect
point);
170
172
CP_EXPORT
cpFloat
cpBodyKineticEnergy
(
const
cpBody
*body);
173
175
typedef
void (*
cpBodyShapeIteratorFunc
)(
cpBody
*body,
cpShape
*shape,
void
*data);
177
CP_EXPORT
void
cpBodyEachShape
(
cpBody
*body,
cpBodyShapeIteratorFunc
func,
void
*data);
178
180
typedef
void (*
cpBodyConstraintIteratorFunc
)(
cpBody
*body,
cpConstraint
*constraint,
void
*data);
182
CP_EXPORT
void
cpBodyEachConstraint
(
cpBody
*body,
cpBodyConstraintIteratorFunc
func,
void
*data);
183
185
typedef
void (*
cpBodyArbiterIteratorFunc
)(
cpBody
*body,
cpArbiter
*arbiter,
void
*data);
187
CP_EXPORT
void
cpBodyEachArbiter
(
cpBody
*body,
cpBodyArbiterIteratorFunc
func,
void
*data);
188
Generated on Thu Jul 2 2015 11:28:11 for Chipmunk2D Pro API Reference by
1.8.3.1