1 /**
2 * Copyright (c) 2006-2019 LOVE Development Team
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 *
8 * Permission is granted to anyone to use this software for any purpose,
9 * including commercial applications, and to alter it and redistribute it
10 * freely, subject to the following restrictions:
11 *
12 * 1. The origin of this software must not be misrepresented; you must not
13 * claim that you wrote the original software. If you use this software
14 * in a product, an acknowledgment in the product documentation would be
15 * appreciated but is not required.
16 * 2. Altered source versions must be plainly marked as such, and must not be
17 * misrepresented as being the original software.
18 * 3. This notice may not be removed or altered from any source distribution.
19 **/
20
21 #include "wrap_Body.h"
22 #include "wrap_Physics.h"
23
24 namespace love
25 {
26 namespace physics
27 {
28 namespace box2d
29 {
30
luax_checkbody(lua_State * L,int idx)31 Body *luax_checkbody(lua_State *L, int idx)
32 {
33 Body *b = luax_checktype<Body>(L, idx);
34 if (b->body == 0)
35 luaL_error(L, "Attempt to use destroyed body.");
36 return b;
37 }
38
w_Body_getX(lua_State * L)39 int w_Body_getX(lua_State *L)
40 {
41 Body *t = luax_checkbody(L, 1);
42 lua_pushnumber(L, t->getX());
43 return 1;
44 }
45
w_Body_getY(lua_State * L)46 int w_Body_getY(lua_State *L)
47 {
48 Body *t = luax_checkbody(L, 1);
49 lua_pushnumber(L, t->getY());
50 return 1;
51 }
52
w_Body_getAngle(lua_State * L)53 int w_Body_getAngle(lua_State *L)
54 {
55 Body *t = luax_checkbody(L, 1);
56 lua_pushnumber(L, t->getAngle());
57 return 1;
58 }
59
w_Body_getPosition(lua_State * L)60 int w_Body_getPosition(lua_State *L)
61 {
62 Body *t = luax_checkbody(L, 1);
63
64 float x_o, y_o;
65 t->getPosition(x_o, y_o);
66 lua_pushnumber(L, x_o);
67 lua_pushnumber(L, y_o);
68
69 return 2;
70 }
71
w_Body_getTransform(lua_State * L)72 int w_Body_getTransform(lua_State *L)
73 {
74 Body *t = luax_checkbody(L, 1);
75
76 float x_o, y_o;
77 t->getPosition(x_o, y_o);
78 lua_pushnumber(L, x_o);
79 lua_pushnumber(L, y_o);
80 lua_pushnumber(L, t->getAngle());
81
82 return 3;
83 }
84
w_Body_getLinearVelocity(lua_State * L)85 int w_Body_getLinearVelocity(lua_State *L)
86 {
87 Body *t = luax_checkbody(L, 1);
88
89 float x_o, y_o;
90 t->getLinearVelocity(x_o, y_o);
91 lua_pushnumber(L, x_o);
92 lua_pushnumber(L, y_o);
93
94 return 2;
95 }
96
w_Body_getWorldCenter(lua_State * L)97 int w_Body_getWorldCenter(lua_State *L)
98 {
99 Body *t = luax_checkbody(L, 1);
100
101 float x_o, y_o;
102 t->getWorldCenter(x_o, y_o);
103 lua_pushnumber(L, x_o);
104 lua_pushnumber(L, y_o);
105
106 return 2;
107 }
108
w_Body_getLocalCenter(lua_State * L)109 int w_Body_getLocalCenter(lua_State *L)
110 {
111 Body *t = luax_checkbody(L, 1);
112
113 float x_o, y_o;
114 t->getLocalCenter(x_o, y_o);
115 lua_pushnumber(L, x_o);
116 lua_pushnumber(L, y_o);
117
118 return 2;
119 }
120
w_Body_getAngularVelocity(lua_State * L)121 int w_Body_getAngularVelocity(lua_State *L)
122 {
123 Body *t = luax_checkbody(L, 1);
124 lua_pushnumber(L, t->getAngularVelocity());
125 return 1;
126 }
127
w_Body_getMass(lua_State * L)128 int w_Body_getMass(lua_State *L)
129 {
130 Body *t = luax_checkbody(L, 1);
131 lua_pushnumber(L, t->getMass());
132 return 1;
133 }
134
w_Body_getInertia(lua_State * L)135 int w_Body_getInertia(lua_State *L)
136 {
137 Body *t = luax_checkbody(L, 1);
138 lua_pushnumber(L, t->getInertia());
139 return 1;
140 }
141
w_Body_getMassData(lua_State * L)142 int w_Body_getMassData(lua_State *L)
143 {
144 Body *t = luax_checkbody(L, 1);
145 lua_remove(L, 1);
146 return t->getMassData(L);
147 }
148
w_Body_getAngularDamping(lua_State * L)149 int w_Body_getAngularDamping(lua_State *L)
150 {
151 Body *t = luax_checkbody(L, 1);
152 lua_pushnumber(L, t->getAngularDamping());
153 return 1;
154 }
155
w_Body_getLinearDamping(lua_State * L)156 int w_Body_getLinearDamping(lua_State *L)
157 {
158 Body *t = luax_checkbody(L, 1);
159 lua_pushnumber(L, t->getLinearDamping());
160 return 1;
161 }
162
w_Body_getGravityScale(lua_State * L)163 int w_Body_getGravityScale(lua_State *L)
164 {
165 Body *t = luax_checkbody(L, 1);
166 lua_pushnumber(L, t->getGravityScale());
167 return 1;
168 }
169
w_Body_getType(lua_State * L)170 int w_Body_getType(lua_State *L)
171 {
172 Body *t = luax_checkbody(L, 1);
173 const char *type = "";
174 Body::getConstant(t->getType(), type);
175 lua_pushstring(L, type);
176 return 1;
177 }
178
w_Body_applyLinearImpulse(lua_State * L)179 int w_Body_applyLinearImpulse(lua_State *L)
180 {
181 Body *t = luax_checkbody(L, 1);
182 float jx = (float)luaL_checknumber(L, 2);
183 float jy = (float)luaL_checknumber(L, 3);
184
185 int nargs = lua_gettop(L);
186
187 if (nargs <= 3 || (nargs == 4 && lua_type(L, 4) == LUA_TBOOLEAN))
188 {
189 bool awake = luax_optboolean(L, 4, true);
190 t->applyLinearImpulse(jx, jy, awake);
191 }
192 else if (nargs >= 5)
193 {
194 float rx = (float)luaL_checknumber(L, 4);
195 float ry = (float)luaL_checknumber(L, 5);
196 bool awake = luax_optboolean(L, 6, true);
197 t->applyLinearImpulse(jx, jy, rx, ry, awake);
198 }
199 else
200 {
201 return luaL_error(L, "Wrong number of parameters.");
202 }
203
204 return 0;
205 }
206
w_Body_applyAngularImpulse(lua_State * L)207 int w_Body_applyAngularImpulse(lua_State *L)
208 {
209 Body *t = luax_checkbody(L, 1);
210 float i = (float)luaL_checknumber(L, 2);
211 bool awake = luax_optboolean(L, 3, true);
212 t->applyAngularImpulse(i, awake);
213 return 0;
214 }
215
w_Body_applyTorque(lua_State * L)216 int w_Body_applyTorque(lua_State *L)
217 {
218 Body *t = luax_checkbody(L, 1);
219 float arg = (float)luaL_checknumber(L, 2);
220 bool awake = luax_optboolean(L, 3, true);
221 t->applyTorque(arg, awake);
222 return 0;
223 }
224
w_Body_applyForce(lua_State * L)225 int w_Body_applyForce(lua_State *L)
226 {
227 Body *t = luax_checkbody(L, 1);
228 float fx = (float)luaL_checknumber(L, 2);
229 float fy = (float)luaL_checknumber(L, 3);
230
231 int nargs = lua_gettop(L);
232
233 if (nargs <= 3 || (nargs == 4 && lua_type(L, 4) == LUA_TBOOLEAN))
234 {
235 bool awake = luax_optboolean(L, 4, true);
236 t->applyForce(fx, fy, awake);
237 }
238 else if (lua_gettop(L) >= 5)
239 {
240 float rx = (float)luaL_checknumber(L, 4);
241 float ry = (float)luaL_checknumber(L, 5);
242 bool awake = luax_optboolean(L, 6, true);
243 t->applyForce(fx, fy, rx, ry, awake);
244 }
245 else
246 {
247 return luaL_error(L, "Wrong number of parameters.");
248 }
249
250 return 0;
251 }
252
w_Body_setX(lua_State * L)253 int w_Body_setX(lua_State *L)
254 {
255 Body *t = luax_checkbody(L, 1);
256 float arg1 = (float)luaL_checknumber(L, 2);
257 luax_catchexcept(L, [&](){ t->setX(arg1); });
258 return 0;
259 }
260
w_Body_setY(lua_State * L)261 int w_Body_setY(lua_State *L)
262 {
263 Body *t = luax_checkbody(L, 1);
264 float arg1 = (float)luaL_checknumber(L, 2);
265 luax_catchexcept(L, [&](){ t->setY(arg1); });
266 return 0;
267 }
268
w_Body_setTransform(lua_State * L)269 int w_Body_setTransform(lua_State *L)
270 {
271 Body *t = luax_checkbody(L, 1);
272 float x = (float)luaL_checknumber(L, 2);
273 float y = (float)luaL_checknumber(L, 3);
274 float angle = (float)luaL_checknumber(L, 4);
275 luax_catchexcept(L, [&](){
276 t->setPosition(x, y);
277 t->setAngle(angle);
278 });
279 return 0;
280 }
281
w_Body_setLinearVelocity(lua_State * L)282 int w_Body_setLinearVelocity(lua_State *L)
283 {
284 Body *t = luax_checkbody(L, 1);
285 float arg1 = (float)luaL_checknumber(L, 2);
286 float arg2 = (float)luaL_checknumber(L, 3);
287 t->setLinearVelocity(arg1, arg2);
288 return 0;
289 }
290
w_Body_setAngle(lua_State * L)291 int w_Body_setAngle(lua_State *L)
292 {
293 Body *t = luax_checkbody(L, 1);
294 float arg1 = (float)luaL_checknumber(L, 2);
295 luax_catchexcept(L, [&](){ t->setAngle(arg1); });
296 return 0;
297 }
298
w_Body_setAngularVelocity(lua_State * L)299 int w_Body_setAngularVelocity(lua_State *L)
300 {
301 Body *t = luax_checkbody(L, 1);
302 float arg1 = (float)luaL_checknumber(L, 2);
303 t->setAngularVelocity(arg1);
304 return 0;
305 }
306
w_Body_setPosition(lua_State * L)307 int w_Body_setPosition(lua_State *L)
308 {
309 Body *t = luax_checkbody(L, 1);
310 float arg1 = (float)luaL_checknumber(L, 2);
311 float arg2 = (float)luaL_checknumber(L, 3);
312 luax_catchexcept(L, [&](){ t->setPosition(arg1, arg2); });
313 return 0;
314 }
315
w_Body_resetMassData(lua_State * L)316 int w_Body_resetMassData(lua_State *L)
317 {
318 Body *t = luax_checkbody(L, 1);
319 luax_catchexcept(L, [&](){ t->resetMassData(); });
320 return 0;
321 }
322
w_Body_setMassData(lua_State * L)323 int w_Body_setMassData(lua_State *L)
324 {
325 Body *t = luax_checkbody(L, 1);
326 float x = (float)luaL_checknumber(L, 2);
327 float y = (float)luaL_checknumber(L, 3);
328 float m = (float)luaL_checknumber(L, 4);
329 float i = (float)luaL_checknumber(L, 5);
330 luax_catchexcept(L, [&](){ t->setMassData(x, y, m, i); });
331 return 0;
332 }
333
w_Body_setMass(lua_State * L)334 int w_Body_setMass(lua_State *L)
335 {
336 Body *t = luax_checkbody(L, 1);
337 float m = (float)luaL_checknumber(L, 2);
338 luax_catchexcept(L, [&](){ t->setMass(m); });
339 return 0;
340 }
341
w_Body_setInertia(lua_State * L)342 int w_Body_setInertia(lua_State *L)
343 {
344 Body *t = luax_checkbody(L, 1);
345 float i = (float)luaL_checknumber(L, 2);
346 luax_catchexcept(L, [&](){ t->setInertia(i); });
347 return 0;
348 }
349
w_Body_setAngularDamping(lua_State * L)350 int w_Body_setAngularDamping(lua_State *L)
351 {
352 Body *t = luax_checkbody(L, 1);
353 float arg1 = (float)luaL_checknumber(L, 2);
354 t->setAngularDamping(arg1);
355 return 0;
356 }
357
w_Body_setLinearDamping(lua_State * L)358 int w_Body_setLinearDamping(lua_State *L)
359 {
360 Body *t = luax_checkbody(L, 1);
361 float arg1 = (float)luaL_checknumber(L, 2);
362 t->setLinearDamping(arg1);
363 return 0;
364 }
365
w_Body_setGravityScale(lua_State * L)366 int w_Body_setGravityScale(lua_State *L)
367 {
368 Body *t = luax_checkbody(L, 1);
369 float arg1 = (float)luaL_checknumber(L, 2);
370 t->setGravityScale(arg1);
371 return 0;
372 }
373
w_Body_setType(lua_State * L)374 int w_Body_setType(lua_State *L)
375 {
376 Body *t = luax_checkbody(L, 1);
377 const char *typeStr = luaL_checkstring(L, 2);
378 Body::Type type;
379 Body::getConstant(typeStr, type);
380 luax_catchexcept(L, [&](){ t->setType(type); });
381 return 0;
382 }
383
w_Body_getWorldPoint(lua_State * L)384 int w_Body_getWorldPoint(lua_State *L)
385 {
386 Body *t = luax_checkbody(L, 1);
387
388 float x = (float)luaL_checknumber(L, 2);
389 float y = (float)luaL_checknumber(L, 3);
390 float x_o, y_o;
391 t->getWorldPoint(x, y, x_o, y_o);
392 lua_pushnumber(L, x_o);
393 lua_pushnumber(L, y_o);
394
395 return 2;
396 }
397
w_Body_getWorldVector(lua_State * L)398 int w_Body_getWorldVector(lua_State *L)
399 {
400 Body *t = luax_checkbody(L, 1);
401
402 float x = (float)luaL_checknumber(L, 2);
403 float y = (float)luaL_checknumber(L, 3);
404 float x_o, y_o;
405 t->getWorldVector(x, y, x_o, y_o);
406 lua_pushnumber(L, x_o);
407 lua_pushnumber(L, y_o);
408
409 return 2;
410 }
411
w_Body_getWorldPoints(lua_State * L)412 int w_Body_getWorldPoints(lua_State *L)
413 {
414 Body *t = luax_checkbody(L, 1);
415 lua_remove(L, 1);
416 return t->getWorldPoints(L);
417 }
418
w_Body_getLocalPoint(lua_State * L)419 int w_Body_getLocalPoint(lua_State *L)
420 {
421 Body *t = luax_checkbody(L, 1);
422
423 float x = (float)luaL_checknumber(L, 2);
424 float y = (float)luaL_checknumber(L, 3);
425 float x_o, y_o;
426 t->getLocalPoint(x, y, x_o, y_o);
427 lua_pushnumber(L, x_o);
428 lua_pushnumber(L, y_o);
429
430 return 2;
431 }
432
w_Body_getLocalVector(lua_State * L)433 int w_Body_getLocalVector(lua_State *L)
434 {
435 Body *t = luax_checkbody(L, 1);
436
437 float x = (float)luaL_checknumber(L, 2);
438 float y = (float)luaL_checknumber(L, 3);
439 float x_o, y_o;
440 t->getLocalVector(x, y, x_o, y_o);
441 lua_pushnumber(L, x_o);
442 lua_pushnumber(L, y_o);
443
444 return 2;
445 }
446
w_Body_getLinearVelocityFromWorldPoint(lua_State * L)447 int w_Body_getLinearVelocityFromWorldPoint(lua_State *L)
448 {
449 Body *t = luax_checkbody(L, 1);
450
451 float x = (float)luaL_checknumber(L, 2);
452 float y = (float)luaL_checknumber(L, 3);
453 float x_o, y_o;
454 t->getLinearVelocityFromWorldPoint(x, y, x_o, y_o);
455 lua_pushnumber(L, x_o);
456 lua_pushnumber(L, y_o);
457
458 return 2;
459 }
460
w_Body_getLinearVelocityFromLocalPoint(lua_State * L)461 int w_Body_getLinearVelocityFromLocalPoint(lua_State *L)
462 {
463 Body *t = luax_checkbody(L, 1);
464
465 float x = (float)luaL_checknumber(L, 2);
466 float y = (float)luaL_checknumber(L, 3);
467 float x_o, y_o;
468 t->getLinearVelocityFromLocalPoint(x, y, x_o, y_o);
469 lua_pushnumber(L, x_o);
470 lua_pushnumber(L, y_o);
471
472 return 2;
473 }
474
w_Body_isBullet(lua_State * L)475 int w_Body_isBullet(lua_State *L)
476 {
477 Body *t = luax_checkbody(L, 1);
478 luax_pushboolean(L, t->isBullet());
479 return 1;
480 }
481
w_Body_setBullet(lua_State * L)482 int w_Body_setBullet(lua_State *L)
483 {
484 Body *t = luax_checkbody(L, 1);
485 bool b = luax_checkboolean(L, 2);
486 t->setBullet(b);
487 return 0;
488 }
489
w_Body_isActive(lua_State * L)490 int w_Body_isActive(lua_State *L)
491 {
492 Body *t = luax_checkbody(L, 1);
493 luax_pushboolean(L, t->isActive());
494 return 1;
495 }
496
w_Body_isAwake(lua_State * L)497 int w_Body_isAwake(lua_State *L)
498 {
499 Body *t = luax_checkbody(L, 1);
500 luax_pushboolean(L, t->isAwake());
501 return 1;
502 }
503
w_Body_setSleepingAllowed(lua_State * L)504 int w_Body_setSleepingAllowed(lua_State *L)
505 {
506 Body *t = luax_checkbody(L, 1);
507 bool b = luax_checkboolean(L, 2);
508 t->setSleepingAllowed(b);
509 return 0;
510 }
511
w_Body_isSleepingAllowed(lua_State * L)512 int w_Body_isSleepingAllowed(lua_State *L)
513 {
514 Body *t = luax_checkbody(L, 1);
515 lua_pushboolean(L, t->isSleepingAllowed());
516 return 1;
517 }
518
w_Body_setActive(lua_State * L)519 int w_Body_setActive(lua_State *L)
520 {
521 Body *t = luax_checkbody(L, 1);
522 bool b = luax_checkboolean(L, 2);
523 luax_catchexcept(L, [&](){ t->setActive(b); });
524 return 0;
525 }
526
w_Body_setAwake(lua_State * L)527 int w_Body_setAwake(lua_State *L)
528 {
529 Body *t = luax_checkbody(L, 1);
530 bool b = luax_checkboolean(L, 2);
531 t->setAwake(b);
532 return 0;
533 }
534
w_Body_setFixedRotation(lua_State * L)535 int w_Body_setFixedRotation(lua_State *L)
536 {
537 Body *t = luax_checkbody(L, 1);
538 bool b = luax_checkboolean(L, 2);
539 luax_catchexcept(L, [&](){ t->setFixedRotation(b); });
540 return 0;
541 }
542
w_Body_isFixedRotation(lua_State * L)543 int w_Body_isFixedRotation(lua_State *L)
544 {
545 Body *t = luax_checkbody(L, 1);
546 bool b = t->isFixedRotation();
547 luax_pushboolean(L, b);
548 return 1;
549 }
550
w_Body_isTouching(lua_State * L)551 int w_Body_isTouching(lua_State *L)
552 {
553 Body *t = luax_checkbody(L, 1);
554 Body *other = luax_checkbody(L, 2);
555 luax_pushboolean(L, t->isTouching(other));
556 return 1;
557 }
558
w_Body_getWorld(lua_State * L)559 int w_Body_getWorld(lua_State *L)
560 {
561 Body *t = luax_checkbody(L, 1);
562 World *world = t->getWorld();
563 luax_pushtype(L, world);
564 return 1;
565 }
566
w_Body_getFixtures(lua_State * L)567 int w_Body_getFixtures(lua_State *L)
568 {
569 Body *t = luax_checkbody(L, 1);
570 lua_remove(L, 1);
571 int n = 0;
572 luax_catchexcept(L, [&](){ n = t->getFixtures(L); });
573 return n;
574 }
575
w_Body_getJoints(lua_State * L)576 int w_Body_getJoints(lua_State *L)
577 {
578 Body *t = luax_checkbody(L, 1);
579 lua_remove(L, 1);
580 int n = 0;
581 luax_catchexcept(L, [&](){ n = t->getJoints(L); });
582 return n;
583 }
584
w_Body_getContacts(lua_State * L)585 int w_Body_getContacts(lua_State *L)
586 {
587 Body *t = luax_checkbody(L, 1);
588 lua_remove(L, 1);
589 int n = 0;
590 luax_catchexcept(L, [&](){ n = t->getContacts(L); });
591 return n;
592 }
593
w_Body_destroy(lua_State * L)594 int w_Body_destroy(lua_State *L)
595 {
596 Body *t = luax_checkbody(L, 1);
597 luax_catchexcept(L, [&](){ t->destroy(); });
598 return 0;
599 }
600
w_Body_isDestroyed(lua_State * L)601 int w_Body_isDestroyed(lua_State *L)
602 {
603 Body *b = luax_checktype<Body>(L, 1);
604 luax_pushboolean(L, b->body == nullptr);
605 return 1;
606 }
607
w_Body_setUserData(lua_State * L)608 int w_Body_setUserData(lua_State *L)
609 {
610 Body *t = luax_checkbody(L, 1);
611 lua_remove(L, 1);
612 return t->setUserData(L);
613 }
614
w_Body_getUserData(lua_State * L)615 int w_Body_getUserData(lua_State *L)
616 {
617 Body *t = luax_checkbody(L, 1);
618 lua_remove(L, 1);
619 return t->getUserData(L);
620 }
621
w_Body_getFixtureList(lua_State * L)622 int w_Body_getFixtureList(lua_State *L)
623 {
624 luax_markdeprecated(L, "Body:getFixtureList", API_METHOD, DEPRECATED_RENAMED, "Body:getFixtures");
625 return w_Body_getFixtures(L);
626 }
627
w_Body_getJointList(lua_State * L)628 int w_Body_getJointList(lua_State *L)
629 {
630 luax_markdeprecated(L, "Body:getJointList", API_METHOD, DEPRECATED_RENAMED, "Body:getJoints");
631 return w_Body_getJoints(L);
632 }
633
w_Body_getContactList(lua_State * L)634 int w_Body_getContactList(lua_State *L)
635 {
636 luax_markdeprecated(L, "Body:getContactList", API_METHOD, DEPRECATED_RENAMED, "Body:getContacts");
637 return w_Body_getContacts(L);
638 }
639
640 static const luaL_Reg w_Body_functions[] =
641 {
642 { "getX", w_Body_getX },
643 { "getY", w_Body_getY },
644 { "getAngle", w_Body_getAngle },
645 { "getPosition", w_Body_getPosition },
646 { "getTransform", w_Body_getTransform },
647 { "setTransform", w_Body_setTransform },
648 { "getLinearVelocity", w_Body_getLinearVelocity },
649 { "getWorldCenter", w_Body_getWorldCenter },
650 { "getLocalCenter", w_Body_getLocalCenter },
651 { "getAngularVelocity", w_Body_getAngularVelocity },
652 { "getMass", w_Body_getMass },
653 { "getInertia", w_Body_getInertia },
654 { "getMassData", w_Body_getMassData },
655 { "getAngularDamping", w_Body_getAngularDamping },
656 { "getLinearDamping", w_Body_getLinearDamping },
657 { "getGravityScale", w_Body_getGravityScale },
658 { "getType", w_Body_getType },
659 { "applyLinearImpulse", w_Body_applyLinearImpulse },
660 { "applyAngularImpulse", w_Body_applyAngularImpulse },
661 { "applyTorque", w_Body_applyTorque },
662 { "applyForce", w_Body_applyForce },
663 { "setX", w_Body_setX },
664 { "setY", w_Body_setY },
665 { "setLinearVelocity", w_Body_setLinearVelocity },
666 { "setAngle", w_Body_setAngle },
667 { "setAngularVelocity", w_Body_setAngularVelocity },
668 { "setPosition", w_Body_setPosition },
669 { "resetMassData", w_Body_resetMassData },
670 { "setMassData", w_Body_setMassData },
671 { "setMass", w_Body_setMass },
672 { "setInertia", w_Body_setInertia },
673 { "setAngularDamping", w_Body_setAngularDamping },
674 { "setLinearDamping", w_Body_setLinearDamping },
675 { "setGravityScale", w_Body_setGravityScale },
676 { "setType", w_Body_setType },
677 { "getWorldPoint", w_Body_getWorldPoint },
678 { "getWorldVector", w_Body_getWorldVector },
679 { "getWorldPoints", w_Body_getWorldPoints },
680 { "getLocalPoint", w_Body_getLocalPoint },
681 { "getLocalVector", w_Body_getLocalVector },
682 { "getLinearVelocityFromWorldPoint", w_Body_getLinearVelocityFromWorldPoint },
683 { "getLinearVelocityFromLocalPoint", w_Body_getLinearVelocityFromLocalPoint },
684 { "isBullet", w_Body_isBullet },
685 { "setBullet", w_Body_setBullet },
686 { "isActive", w_Body_isActive },
687 { "isAwake", w_Body_isAwake },
688 { "setSleepingAllowed", w_Body_setSleepingAllowed },
689 { "isSleepingAllowed", w_Body_isSleepingAllowed },
690 { "setActive", w_Body_setActive },
691 { "setAwake", w_Body_setAwake },
692 { "setFixedRotation", w_Body_setFixedRotation },
693 { "isFixedRotation", w_Body_isFixedRotation },
694 { "isTouching", w_Body_isTouching },
695 { "getWorld", w_Body_getWorld },
696 { "getFixtures", w_Body_getFixtures },
697 { "getJoints", w_Body_getJoints },
698 { "getContacts", w_Body_getContacts },
699 { "destroy", w_Body_destroy },
700 { "isDestroyed", w_Body_isDestroyed },
701 { "setUserData", w_Body_setUserData },
702 { "getUserData", w_Body_getUserData },
703
704 // Deprectaed
705 { "getFixtureList", w_Body_getFixtureList },
706 { "getJointList", w_Body_getJointList },
707 { "getContactList", w_Body_getContactList },
708
709 { 0, 0 }
710 };
711
luaopen_body(lua_State * L)712 extern "C" int luaopen_body(lua_State *L)
713 {
714 return luax_register_type(L, &Body::type, w_Body_functions, nullptr);
715 }
716
717 } // box2d
718 } // physics
719 } // love
720