axmol/extensions/physics-nodes/CCPhysicsDebugNode.cpp

252 lines
8.7 KiB
C++
Raw Normal View History

2012-11-09 17:52:12 +08:00
/* Copyright (c) 2012 Scott Lembcke and Howling Moon Software
* Copyright (c) 2012 cocos2d-x.org
* Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
* Copyright (c) 2021 @aismann; Peter Eismann, Germany; dreifrankensoft
2012-11-09 17:52:12 +08:00
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "CCPhysicsDebugNode.h"
Squashed commit of the following: commit 36c2807d07848448c1fed86f4b119205048691bf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 13:11:40 2016 -0800 binary file 82 commit 9b7cd003b12faefd0522d12f765c027efb001ab2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:56:39 2016 -0800 fore multiple in windows phone 8.1 too commit daea8a3ef8d69915e7a9d962fd745a1103011bab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:50:45 2016 -0800 force multiple commit 0fbabdbf99974e95de083d79c7d6ae7cf735e4b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 10:44:40 2016 -0800 compiles commit f817766afcd0ffc4ca93f628d55fabc4b5a96ba5 Merge: 7b2cea3 8bf3d33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 09:37:24 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 7b2cea329a56ae2786428d39a499bc12ba3860e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sat Feb 27 01:11:13 2016 -0800 correct paths for win8.1 commit dcf1f046eb1e18474d6f94b2d7dc31fbf1b06cea Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 22:46:58 2016 -0800 projects works on win32 commit ab5b14c25ef0fdf224480302f9cb3cc01d5c360c Merge: 04377cc 9af2f4e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:57:10 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 04377cce7f46b2c2016ccc3855fc479c4f6aa516 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:26:55 2016 -0800 trying to make it compile on win32 commit 7703946d99e1cdc6a57f2ccb2a868818c1367291 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 10:28:12 2016 -0800 quick hack to make it compile... ...autogenerated files will fix it. commit ea35bf3a5894cb80b09ecd0a4a5408dcc19785f5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 09:20:59 2016 -0800 Squashed commit of the following: commit 487e52a7af7cdb40135fd3bd83b2efba0dfe6265 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 20:10:13 2016 -0800 compiles.. sort of commit a7990e2888d5ef1e43b811148b23c0b899105ab3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:55:24 2016 -0800 more chipmunk fixes commit 1174f6ec8201324161d7946af0f493b136a56690 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:36:15 2016 -0800 more chipmunk fixes commit 00ac2449ca0c35bd9184310d58e74aaa05bd1323 Merge: f942c5a 0594d3c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:29:27 2016 -0800 Merge branch 'chipmunk_v7_squashed' of github.com:ricardoquesada/cocos2d-x into chipmunk_v7_squashed commit f942c5a3cc7b24f3ac211d781be1b9c9d4ec0fd7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:28:51 2016 -0800 correct path for chipmunk commit 0594d3c4141d390b2566ea76101e383f15ebcaaf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 18:44:05 2016 -0800 compiles on ios commit 379503399c384ad77d25d68a2f83b71a829b1c04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:51:36 2016 -0800 chipmunk include fixes commit 95839fb7b406a32255853294b016d8c15aec1ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:09:04 2016 -0800 fixes for cmake + mac commit 39449ea3b7efccae2946785c1c11433d964ee480 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:51:25 2016 -0800 correct includes commit 98e97d7d2f00e6a78d040dcaf17e5a077e9a88c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:35:40 2016 -0800 fixes chipmunk with cmake commit 337f21f9466703722847635301d841ace9b757cb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:42:01 2016 -0800 updates android and linux projects commit 7111a9993b97f78cf73206804b25665c21a59ca8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:18:26 2016 -0800 cosmetic changes commit ce15038b8d2c0c7ebe31b4e1efe92646b7c70d1b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:53:41 2016 -0800 chipmunk autogenerated files commit 66c71bfa3aaab04abf25f284e2e76ce2a74a98de Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:47:41 2016 -0800 compatibility both in JS (to reduce space) and in C for (C++ users) commit 0f9ffa0a8ab23a19e1f10b04e6987c2288764b1f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:10:02 2016 -0800 mooooore fixes commit 9ab23014093677e8eda69b105f50410b8c792aa3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:30:58 2016 -0800 doesn't crash with collision handler commit 69275a16817a038244bbaaff9e82a011b6729cb2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:16:29 2016 -0800 adds missing space functions commit a6b97bbc76cb9ab293356bb7451cfa858353f589 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 22:22:27 2016 -0800 queries... better commit 3442bceca64f5a0ddbbbb1a288146a2a61d87632 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 19:48:41 2016 -0800 adds more missing functions fixes other chipmunk JS issues commit 3797a033896d059da58a05ce0de832ed9c150eff Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 18:30:21 2016 -0800 yep... poly works ok commit d1bb57776891605b9d3e4fb90736c6869d96b944 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:29 2016 -0800 neede compat files commit 39ec518d4e089124d9a53fe3a8dce3aa0474c233 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:04 2016 -0800 query working! commit 71a8001fd6bc03ac674621f5da38a3f8778430b4 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:57:03 2016 -0800 almost there commit 9272fdcd06ba188db2fe5701fb2ac21476d54883 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:18:46 2016 -0800 fixes return values commit 7218778da846e1e36a510c0a19a5ee76f91db032 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 20:36:14 2016 -0800 cpMomentForSegment is manual since parameter 4 is optional in chipmunk 6, but not in 7 commit 98d5d3e23c2cdb941cc0b1f3ce8275990356e88d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 17:29:28 2016 -0800 yeah... process the arguments correctly works both for functions and auto_classes commit ce6a4fe3593b4f3b0fcdf11d12e297d789e0d96b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 16:49:00 2016 -0800 compiles and links fixes some issues with the queries. returns shapes instad of the queryInfo commit 3f879482dc6db86e45e4319bc802ccf19b52a46c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 15:03:18 2016 -0800 adds removeCollisionHandler and other fixes commit 32d825fc7bd323e144db6a1badc4a62420b6ea44 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Feb 18 20:59:24 2016 -0800 compiles... doesn't work yet commit bd64de81713fb2d7652a538d667d73f05f5d9320 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 17 18:17:39 2016 -0800 WIP: chipmunk bindings
2016-03-01 05:53:00 +08:00
#include "chipmunk/chipmunk_private.h"
2014-04-30 08:37:36 +08:00
#include "base/ccTypes.h"
2021-10-23 23:27:14 +08:00
#include "math/CCMath.h"
2012-11-09 17:52:12 +08:00
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <limits.h>
#include <string.h>
NS_CC_EXT_BEGIN
2012-11-09 17:52:12 +08:00
/*
IMPORTANT - READ ME!
2021-12-25 10:04:45 +08:00
2012-11-09 17:52:12 +08:00
This file sets pokes around in the private API a lot to provide efficient
debug rendering given nothing more than reference to a Chipmunk space.
It is not recommended to write rendering code like this in your own games
as the private API may change with little or no warning.
*/
static const cpVect spring_verts[] = {
2021-12-25 10:04:45 +08:00
{0.00f, 0.0f}, {0.20f, 0.0f}, {0.25f, 3.0f}, {0.30f, -6.0f}, {0.35f, 6.0f},
{0.40f, -6.0f}, {0.45f, 6.0f}, {0.50f, -6.0f}, {0.55f, 6.0f}, {0.60f, -6.0f},
{0.65f, 6.0f}, {0.70f, -3.0f}, {0.75f, 6.0f}, {0.80f, 0.0f}, {1.00f, 0.0f},
};
static const int spring_count = sizeof(spring_verts) / sizeof(cpVect);
2021-12-25 10:04:45 +08:00
static Color4F ColorForBody(cpBody* body)
2012-11-09 17:52:12 +08:00
{
if (CP_BODY_TYPE_STATIC == cpBodyGetType(body) || cpBodyIsSleeping(body))
2012-11-09 17:52:12 +08:00
{
2021-12-25 10:04:45 +08:00
return Color4F(0.5f, 0.5f, 0.5f, 0.5f);
}
Squashed commit of the following: commit 36c2807d07848448c1fed86f4b119205048691bf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 13:11:40 2016 -0800 binary file 82 commit 9b7cd003b12faefd0522d12f765c027efb001ab2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:56:39 2016 -0800 fore multiple in windows phone 8.1 too commit daea8a3ef8d69915e7a9d962fd745a1103011bab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:50:45 2016 -0800 force multiple commit 0fbabdbf99974e95de083d79c7d6ae7cf735e4b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 10:44:40 2016 -0800 compiles commit f817766afcd0ffc4ca93f628d55fabc4b5a96ba5 Merge: 7b2cea3 8bf3d33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 09:37:24 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 7b2cea329a56ae2786428d39a499bc12ba3860e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sat Feb 27 01:11:13 2016 -0800 correct paths for win8.1 commit dcf1f046eb1e18474d6f94b2d7dc31fbf1b06cea Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 22:46:58 2016 -0800 projects works on win32 commit ab5b14c25ef0fdf224480302f9cb3cc01d5c360c Merge: 04377cc 9af2f4e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:57:10 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 04377cce7f46b2c2016ccc3855fc479c4f6aa516 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:26:55 2016 -0800 trying to make it compile on win32 commit 7703946d99e1cdc6a57f2ccb2a868818c1367291 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 10:28:12 2016 -0800 quick hack to make it compile... ...autogenerated files will fix it. commit ea35bf3a5894cb80b09ecd0a4a5408dcc19785f5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 09:20:59 2016 -0800 Squashed commit of the following: commit 487e52a7af7cdb40135fd3bd83b2efba0dfe6265 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 20:10:13 2016 -0800 compiles.. sort of commit a7990e2888d5ef1e43b811148b23c0b899105ab3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:55:24 2016 -0800 more chipmunk fixes commit 1174f6ec8201324161d7946af0f493b136a56690 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:36:15 2016 -0800 more chipmunk fixes commit 00ac2449ca0c35bd9184310d58e74aaa05bd1323 Merge: f942c5a 0594d3c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:29:27 2016 -0800 Merge branch 'chipmunk_v7_squashed' of github.com:ricardoquesada/cocos2d-x into chipmunk_v7_squashed commit f942c5a3cc7b24f3ac211d781be1b9c9d4ec0fd7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:28:51 2016 -0800 correct path for chipmunk commit 0594d3c4141d390b2566ea76101e383f15ebcaaf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 18:44:05 2016 -0800 compiles on ios commit 379503399c384ad77d25d68a2f83b71a829b1c04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:51:36 2016 -0800 chipmunk include fixes commit 95839fb7b406a32255853294b016d8c15aec1ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:09:04 2016 -0800 fixes for cmake + mac commit 39449ea3b7efccae2946785c1c11433d964ee480 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:51:25 2016 -0800 correct includes commit 98e97d7d2f00e6a78d040dcaf17e5a077e9a88c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:35:40 2016 -0800 fixes chipmunk with cmake commit 337f21f9466703722847635301d841ace9b757cb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:42:01 2016 -0800 updates android and linux projects commit 7111a9993b97f78cf73206804b25665c21a59ca8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:18:26 2016 -0800 cosmetic changes commit ce15038b8d2c0c7ebe31b4e1efe92646b7c70d1b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:53:41 2016 -0800 chipmunk autogenerated files commit 66c71bfa3aaab04abf25f284e2e76ce2a74a98de Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:47:41 2016 -0800 compatibility both in JS (to reduce space) and in C for (C++ users) commit 0f9ffa0a8ab23a19e1f10b04e6987c2288764b1f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:10:02 2016 -0800 mooooore fixes commit 9ab23014093677e8eda69b105f50410b8c792aa3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:30:58 2016 -0800 doesn't crash with collision handler commit 69275a16817a038244bbaaff9e82a011b6729cb2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:16:29 2016 -0800 adds missing space functions commit a6b97bbc76cb9ab293356bb7451cfa858353f589 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 22:22:27 2016 -0800 queries... better commit 3442bceca64f5a0ddbbbb1a288146a2a61d87632 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 19:48:41 2016 -0800 adds more missing functions fixes other chipmunk JS issues commit 3797a033896d059da58a05ce0de832ed9c150eff Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 18:30:21 2016 -0800 yep... poly works ok commit d1bb57776891605b9d3e4fb90736c6869d96b944 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:29 2016 -0800 neede compat files commit 39ec518d4e089124d9a53fe3a8dce3aa0474c233 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:04 2016 -0800 query working! commit 71a8001fd6bc03ac674621f5da38a3f8778430b4 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:57:03 2016 -0800 almost there commit 9272fdcd06ba188db2fe5701fb2ac21476d54883 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:18:46 2016 -0800 fixes return values commit 7218778da846e1e36a510c0a19a5ee76f91db032 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 20:36:14 2016 -0800 cpMomentForSegment is manual since parameter 4 is optional in chipmunk 6, but not in 7 commit 98d5d3e23c2cdb941cc0b1f3ce8275990356e88d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 17:29:28 2016 -0800 yeah... process the arguments correctly works both for functions and auto_classes commit ce6a4fe3593b4f3b0fcdf11d12e297d789e0d96b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 16:49:00 2016 -0800 compiles and links fixes some issues with the queries. returns shapes instad of the queryInfo commit 3f879482dc6db86e45e4319bc802ccf19b52a46c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 15:03:18 2016 -0800 adds removeCollisionHandler and other fixes commit 32d825fc7bd323e144db6a1badc4a62420b6ea44 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Feb 18 20:59:24 2016 -0800 compiles... doesn't work yet commit bd64de81713fb2d7652a538d667d73f05f5d9320 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 17 18:17:39 2016 -0800 WIP: chipmunk bindings
2016-03-01 05:53:00 +08:00
else if (body->sleeping.idleTime > cpBodyGetSpace(body)->sleepTimeThreshold)
2012-11-09 17:52:12 +08:00
{
return Color4F(0.33f, 0.33f, 0.33f, 0.5f);
}
2012-11-09 17:52:12 +08:00
else
{
return Color4F(1.0f, 0.0f, 0.0f, 0.5f);
}
2012-11-09 17:52:12 +08:00
}
2021-12-25 10:04:45 +08:00
static Vec2 cpVert2Point(const cpVect& vert)
2012-11-09 17:52:12 +08:00
{
2021-12-25 10:04:45 +08:00
return (Vec2(vert.x, vert.y));
2012-11-09 17:52:12 +08:00
}
2021-12-25 10:04:45 +08:00
static void DrawShape(cpShape* shape, DrawNode* renderer)
2012-11-09 17:52:12 +08:00
{
2021-12-25 10:04:45 +08:00
cpBody* body = cpShapeGetBody(shape);
Color4F color = ColorForBody(body);
2021-12-25 10:04:45 +08:00
switch (shape->klass->type)
2012-11-09 17:52:12 +08:00
{
2021-12-25 10:04:45 +08:00
case CP_CIRCLE_SHAPE:
{
cpCircleShape* circle = (cpCircleShape*)shape;
cpVect center = circle->tc;
cpFloat radius = circle->r;
renderer->drawDot(cpVert2Point(center), cpfmax(radius, 1.0), color);
renderer->drawSegment(cpVert2Point(center),
cpVert2Point(cpvadd(center, cpvmult(cpBodyGetRotation(body), radius))), 1.0, color);
}
break;
case CP_SEGMENT_SHAPE:
{
cpSegmentShape* seg = (cpSegmentShape*)shape;
renderer->drawSegment(cpVert2Point(seg->ta), cpVert2Point(seg->tb), cpfmax(seg->r, 1.0), color);
}
break;
case CP_POLY_SHAPE:
{
cpPolyShape* poly = (cpPolyShape*)shape;
Color4F line = color;
line.a = cpflerp(color.a, 1.0, 0.5);
int num = poly->count;
Vec2* pPoints = new Vec2[num];
for (int i = 0; i < num; ++i)
pPoints[i] = cpVert2Point(poly->planes[i].v0);
if (cpfmax(poly->r, 1.0) > 1.0)
2012-11-09 17:52:12 +08:00
{
2021-12-25 10:04:45 +08:00
renderer->drawPolygon(pPoints, num, Color4F(0.5f, 0.5f, 0.5f, 0.0f), poly->r, color);
2012-11-09 17:52:12 +08:00
}
2021-12-25 10:04:45 +08:00
else
2012-11-09 17:52:12 +08:00
{
2021-12-25 10:04:45 +08:00
renderer->drawPolygon(pPoints, num, color, 1.0, line);
2012-11-09 17:52:12 +08:00
}
2021-12-25 10:04:45 +08:00
CC_SAFE_DELETE_ARRAY(pPoints);
}
break;
default:
cpAssertHard(false, "Bad assertion in DrawShape()");
}
2012-11-09 17:52:12 +08:00
}
static Color4F CONSTRAINT_COLOR(0, 1, 0, 0.5);
2012-11-09 17:52:12 +08:00
2021-12-25 10:04:45 +08:00
static void DrawConstraint(cpConstraint* constraint, DrawNode* renderer)
2012-11-09 17:52:12 +08:00
{
2021-12-25 10:04:45 +08:00
cpBody* body_a = cpConstraintGetBodyA(constraint);
cpBody* body_b = cpConstraintGetBodyB(constraint);
if (cpConstraintIsPinJoint(constraint))
2012-11-09 17:52:12 +08:00
{
2021-12-25 10:04:45 +08:00
cpVect a =
cpvadd(cpBodyGetPosition(body_a), cpvrotate(cpPinJointGetAnchorA(constraint), cpBodyGetRotation(body_a)));
cpVect b =
cpvadd(cpBodyGetPosition(body_b), cpvrotate(cpPinJointGetAnchorB(constraint), cpBodyGetRotation(body_b)));
2013-07-12 18:04:32 +08:00
renderer->drawDot(cpVert2Point(a), 3.0, CONSTRAINT_COLOR);
renderer->drawDot(cpVert2Point(b), 3.0, CONSTRAINT_COLOR);
renderer->drawSegment(cpVert2Point(a), cpVert2Point(b), 1.0, CONSTRAINT_COLOR);
Squashed commit of the following: commit 36c2807d07848448c1fed86f4b119205048691bf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 13:11:40 2016 -0800 binary file 82 commit 9b7cd003b12faefd0522d12f765c027efb001ab2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:56:39 2016 -0800 fore multiple in windows phone 8.1 too commit daea8a3ef8d69915e7a9d962fd745a1103011bab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:50:45 2016 -0800 force multiple commit 0fbabdbf99974e95de083d79c7d6ae7cf735e4b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 10:44:40 2016 -0800 compiles commit f817766afcd0ffc4ca93f628d55fabc4b5a96ba5 Merge: 7b2cea3 8bf3d33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 09:37:24 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 7b2cea329a56ae2786428d39a499bc12ba3860e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sat Feb 27 01:11:13 2016 -0800 correct paths for win8.1 commit dcf1f046eb1e18474d6f94b2d7dc31fbf1b06cea Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 22:46:58 2016 -0800 projects works on win32 commit ab5b14c25ef0fdf224480302f9cb3cc01d5c360c Merge: 04377cc 9af2f4e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:57:10 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 04377cce7f46b2c2016ccc3855fc479c4f6aa516 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:26:55 2016 -0800 trying to make it compile on win32 commit 7703946d99e1cdc6a57f2ccb2a868818c1367291 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 10:28:12 2016 -0800 quick hack to make it compile... ...autogenerated files will fix it. commit ea35bf3a5894cb80b09ecd0a4a5408dcc19785f5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 09:20:59 2016 -0800 Squashed commit of the following: commit 487e52a7af7cdb40135fd3bd83b2efba0dfe6265 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 20:10:13 2016 -0800 compiles.. sort of commit a7990e2888d5ef1e43b811148b23c0b899105ab3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:55:24 2016 -0800 more chipmunk fixes commit 1174f6ec8201324161d7946af0f493b136a56690 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:36:15 2016 -0800 more chipmunk fixes commit 00ac2449ca0c35bd9184310d58e74aaa05bd1323 Merge: f942c5a 0594d3c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:29:27 2016 -0800 Merge branch 'chipmunk_v7_squashed' of github.com:ricardoquesada/cocos2d-x into chipmunk_v7_squashed commit f942c5a3cc7b24f3ac211d781be1b9c9d4ec0fd7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:28:51 2016 -0800 correct path for chipmunk commit 0594d3c4141d390b2566ea76101e383f15ebcaaf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 18:44:05 2016 -0800 compiles on ios commit 379503399c384ad77d25d68a2f83b71a829b1c04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:51:36 2016 -0800 chipmunk include fixes commit 95839fb7b406a32255853294b016d8c15aec1ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:09:04 2016 -0800 fixes for cmake + mac commit 39449ea3b7efccae2946785c1c11433d964ee480 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:51:25 2016 -0800 correct includes commit 98e97d7d2f00e6a78d040dcaf17e5a077e9a88c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:35:40 2016 -0800 fixes chipmunk with cmake commit 337f21f9466703722847635301d841ace9b757cb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:42:01 2016 -0800 updates android and linux projects commit 7111a9993b97f78cf73206804b25665c21a59ca8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:18:26 2016 -0800 cosmetic changes commit ce15038b8d2c0c7ebe31b4e1efe92646b7c70d1b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:53:41 2016 -0800 chipmunk autogenerated files commit 66c71bfa3aaab04abf25f284e2e76ce2a74a98de Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:47:41 2016 -0800 compatibility both in JS (to reduce space) and in C for (C++ users) commit 0f9ffa0a8ab23a19e1f10b04e6987c2288764b1f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:10:02 2016 -0800 mooooore fixes commit 9ab23014093677e8eda69b105f50410b8c792aa3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:30:58 2016 -0800 doesn't crash with collision handler commit 69275a16817a038244bbaaff9e82a011b6729cb2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:16:29 2016 -0800 adds missing space functions commit a6b97bbc76cb9ab293356bb7451cfa858353f589 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 22:22:27 2016 -0800 queries... better commit 3442bceca64f5a0ddbbbb1a288146a2a61d87632 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 19:48:41 2016 -0800 adds more missing functions fixes other chipmunk JS issues commit 3797a033896d059da58a05ce0de832ed9c150eff Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 18:30:21 2016 -0800 yep... poly works ok commit d1bb57776891605b9d3e4fb90736c6869d96b944 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:29 2016 -0800 neede compat files commit 39ec518d4e089124d9a53fe3a8dce3aa0474c233 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:04 2016 -0800 query working! commit 71a8001fd6bc03ac674621f5da38a3f8778430b4 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:57:03 2016 -0800 almost there commit 9272fdcd06ba188db2fe5701fb2ac21476d54883 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:18:46 2016 -0800 fixes return values commit 7218778da846e1e36a510c0a19a5ee76f91db032 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 20:36:14 2016 -0800 cpMomentForSegment is manual since parameter 4 is optional in chipmunk 6, but not in 7 commit 98d5d3e23c2cdb941cc0b1f3ce8275990356e88d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 17:29:28 2016 -0800 yeah... process the arguments correctly works both for functions and auto_classes commit ce6a4fe3593b4f3b0fcdf11d12e297d789e0d96b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 16:49:00 2016 -0800 compiles and links fixes some issues with the queries. returns shapes instad of the queryInfo commit 3f879482dc6db86e45e4319bc802ccf19b52a46c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 15:03:18 2016 -0800 adds removeCollisionHandler and other fixes commit 32d825fc7bd323e144db6a1badc4a62420b6ea44 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Feb 18 20:59:24 2016 -0800 compiles... doesn't work yet commit bd64de81713fb2d7652a538d667d73f05f5d9320 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 17 18:17:39 2016 -0800 WIP: chipmunk bindings
2016-03-01 05:53:00 +08:00
}
2021-12-25 10:04:45 +08:00
else if (cpConstraintIsSlideJoint(constraint))
2012-11-09 17:52:12 +08:00
{
2021-12-25 10:04:45 +08:00
cpVect a =
cpvadd(cpBodyGetPosition(body_a), cpvrotate(cpSlideJointGetAnchorA(constraint), cpBodyGetRotation(body_a)));
cpVect b =
cpvadd(cpBodyGetPosition(body_b), cpvrotate(cpSlideJointGetAnchorB(constraint), cpBodyGetRotation(body_b)));
2013-07-12 18:04:32 +08:00
renderer->drawDot(cpVert2Point(a), 3.0, CONSTRAINT_COLOR);
renderer->drawDot(cpVert2Point(b), 3.0, CONSTRAINT_COLOR);
renderer->drawSegment(cpVert2Point(a), cpVert2Point(b), 1.0, CONSTRAINT_COLOR);
Squashed commit of the following: commit 36c2807d07848448c1fed86f4b119205048691bf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 13:11:40 2016 -0800 binary file 82 commit 9b7cd003b12faefd0522d12f765c027efb001ab2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:56:39 2016 -0800 fore multiple in windows phone 8.1 too commit daea8a3ef8d69915e7a9d962fd745a1103011bab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:50:45 2016 -0800 force multiple commit 0fbabdbf99974e95de083d79c7d6ae7cf735e4b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 10:44:40 2016 -0800 compiles commit f817766afcd0ffc4ca93f628d55fabc4b5a96ba5 Merge: 7b2cea3 8bf3d33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 09:37:24 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 7b2cea329a56ae2786428d39a499bc12ba3860e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sat Feb 27 01:11:13 2016 -0800 correct paths for win8.1 commit dcf1f046eb1e18474d6f94b2d7dc31fbf1b06cea Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 22:46:58 2016 -0800 projects works on win32 commit ab5b14c25ef0fdf224480302f9cb3cc01d5c360c Merge: 04377cc 9af2f4e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:57:10 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 04377cce7f46b2c2016ccc3855fc479c4f6aa516 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:26:55 2016 -0800 trying to make it compile on win32 commit 7703946d99e1cdc6a57f2ccb2a868818c1367291 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 10:28:12 2016 -0800 quick hack to make it compile... ...autogenerated files will fix it. commit ea35bf3a5894cb80b09ecd0a4a5408dcc19785f5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 09:20:59 2016 -0800 Squashed commit of the following: commit 487e52a7af7cdb40135fd3bd83b2efba0dfe6265 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 20:10:13 2016 -0800 compiles.. sort of commit a7990e2888d5ef1e43b811148b23c0b899105ab3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:55:24 2016 -0800 more chipmunk fixes commit 1174f6ec8201324161d7946af0f493b136a56690 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:36:15 2016 -0800 more chipmunk fixes commit 00ac2449ca0c35bd9184310d58e74aaa05bd1323 Merge: f942c5a 0594d3c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:29:27 2016 -0800 Merge branch 'chipmunk_v7_squashed' of github.com:ricardoquesada/cocos2d-x into chipmunk_v7_squashed commit f942c5a3cc7b24f3ac211d781be1b9c9d4ec0fd7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:28:51 2016 -0800 correct path for chipmunk commit 0594d3c4141d390b2566ea76101e383f15ebcaaf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 18:44:05 2016 -0800 compiles on ios commit 379503399c384ad77d25d68a2f83b71a829b1c04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:51:36 2016 -0800 chipmunk include fixes commit 95839fb7b406a32255853294b016d8c15aec1ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:09:04 2016 -0800 fixes for cmake + mac commit 39449ea3b7efccae2946785c1c11433d964ee480 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:51:25 2016 -0800 correct includes commit 98e97d7d2f00e6a78d040dcaf17e5a077e9a88c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:35:40 2016 -0800 fixes chipmunk with cmake commit 337f21f9466703722847635301d841ace9b757cb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:42:01 2016 -0800 updates android and linux projects commit 7111a9993b97f78cf73206804b25665c21a59ca8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:18:26 2016 -0800 cosmetic changes commit ce15038b8d2c0c7ebe31b4e1efe92646b7c70d1b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:53:41 2016 -0800 chipmunk autogenerated files commit 66c71bfa3aaab04abf25f284e2e76ce2a74a98de Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:47:41 2016 -0800 compatibility both in JS (to reduce space) and in C for (C++ users) commit 0f9ffa0a8ab23a19e1f10b04e6987c2288764b1f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:10:02 2016 -0800 mooooore fixes commit 9ab23014093677e8eda69b105f50410b8c792aa3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:30:58 2016 -0800 doesn't crash with collision handler commit 69275a16817a038244bbaaff9e82a011b6729cb2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:16:29 2016 -0800 adds missing space functions commit a6b97bbc76cb9ab293356bb7451cfa858353f589 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 22:22:27 2016 -0800 queries... better commit 3442bceca64f5a0ddbbbb1a288146a2a61d87632 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 19:48:41 2016 -0800 adds more missing functions fixes other chipmunk JS issues commit 3797a033896d059da58a05ce0de832ed9c150eff Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 18:30:21 2016 -0800 yep... poly works ok commit d1bb57776891605b9d3e4fb90736c6869d96b944 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:29 2016 -0800 neede compat files commit 39ec518d4e089124d9a53fe3a8dce3aa0474c233 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:04 2016 -0800 query working! commit 71a8001fd6bc03ac674621f5da38a3f8778430b4 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:57:03 2016 -0800 almost there commit 9272fdcd06ba188db2fe5701fb2ac21476d54883 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:18:46 2016 -0800 fixes return values commit 7218778da846e1e36a510c0a19a5ee76f91db032 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 20:36:14 2016 -0800 cpMomentForSegment is manual since parameter 4 is optional in chipmunk 6, but not in 7 commit 98d5d3e23c2cdb941cc0b1f3ce8275990356e88d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 17:29:28 2016 -0800 yeah... process the arguments correctly works both for functions and auto_classes commit ce6a4fe3593b4f3b0fcdf11d12e297d789e0d96b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 16:49:00 2016 -0800 compiles and links fixes some issues with the queries. returns shapes instad of the queryInfo commit 3f879482dc6db86e45e4319bc802ccf19b52a46c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 15:03:18 2016 -0800 adds removeCollisionHandler and other fixes commit 32d825fc7bd323e144db6a1badc4a62420b6ea44 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Feb 18 20:59:24 2016 -0800 compiles... doesn't work yet commit bd64de81713fb2d7652a538d667d73f05f5d9320 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 17 18:17:39 2016 -0800 WIP: chipmunk bindings
2016-03-01 05:53:00 +08:00
}
2021-12-25 10:04:45 +08:00
else if (cpConstraintIsPivotJoint(constraint))
2012-11-09 17:52:12 +08:00
{
2021-12-25 10:04:45 +08:00
cpVect a =
cpvadd(cpBodyGetPosition(body_a), cpvrotate(cpPivotJointGetAnchorA(constraint), cpBodyGetRotation(body_a)));
cpVect b =
cpvadd(cpBodyGetPosition(body_b), cpvrotate(cpPivotJointGetAnchorB(constraint), cpBodyGetRotation(body_b)));
2013-07-12 18:04:32 +08:00
renderer->drawDot(cpVert2Point(a), 3.0, CONSTRAINT_COLOR);
renderer->drawDot(cpVert2Point(b), 3.0, CONSTRAINT_COLOR);
Squashed commit of the following: commit 36c2807d07848448c1fed86f4b119205048691bf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 13:11:40 2016 -0800 binary file 82 commit 9b7cd003b12faefd0522d12f765c027efb001ab2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:56:39 2016 -0800 fore multiple in windows phone 8.1 too commit daea8a3ef8d69915e7a9d962fd745a1103011bab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:50:45 2016 -0800 force multiple commit 0fbabdbf99974e95de083d79c7d6ae7cf735e4b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 10:44:40 2016 -0800 compiles commit f817766afcd0ffc4ca93f628d55fabc4b5a96ba5 Merge: 7b2cea3 8bf3d33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 09:37:24 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 7b2cea329a56ae2786428d39a499bc12ba3860e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sat Feb 27 01:11:13 2016 -0800 correct paths for win8.1 commit dcf1f046eb1e18474d6f94b2d7dc31fbf1b06cea Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 22:46:58 2016 -0800 projects works on win32 commit ab5b14c25ef0fdf224480302f9cb3cc01d5c360c Merge: 04377cc 9af2f4e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:57:10 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 04377cce7f46b2c2016ccc3855fc479c4f6aa516 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:26:55 2016 -0800 trying to make it compile on win32 commit 7703946d99e1cdc6a57f2ccb2a868818c1367291 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 10:28:12 2016 -0800 quick hack to make it compile... ...autogenerated files will fix it. commit ea35bf3a5894cb80b09ecd0a4a5408dcc19785f5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 09:20:59 2016 -0800 Squashed commit of the following: commit 487e52a7af7cdb40135fd3bd83b2efba0dfe6265 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 20:10:13 2016 -0800 compiles.. sort of commit a7990e2888d5ef1e43b811148b23c0b899105ab3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:55:24 2016 -0800 more chipmunk fixes commit 1174f6ec8201324161d7946af0f493b136a56690 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:36:15 2016 -0800 more chipmunk fixes commit 00ac2449ca0c35bd9184310d58e74aaa05bd1323 Merge: f942c5a 0594d3c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:29:27 2016 -0800 Merge branch 'chipmunk_v7_squashed' of github.com:ricardoquesada/cocos2d-x into chipmunk_v7_squashed commit f942c5a3cc7b24f3ac211d781be1b9c9d4ec0fd7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:28:51 2016 -0800 correct path for chipmunk commit 0594d3c4141d390b2566ea76101e383f15ebcaaf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 18:44:05 2016 -0800 compiles on ios commit 379503399c384ad77d25d68a2f83b71a829b1c04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:51:36 2016 -0800 chipmunk include fixes commit 95839fb7b406a32255853294b016d8c15aec1ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:09:04 2016 -0800 fixes for cmake + mac commit 39449ea3b7efccae2946785c1c11433d964ee480 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:51:25 2016 -0800 correct includes commit 98e97d7d2f00e6a78d040dcaf17e5a077e9a88c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:35:40 2016 -0800 fixes chipmunk with cmake commit 337f21f9466703722847635301d841ace9b757cb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:42:01 2016 -0800 updates android and linux projects commit 7111a9993b97f78cf73206804b25665c21a59ca8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:18:26 2016 -0800 cosmetic changes commit ce15038b8d2c0c7ebe31b4e1efe92646b7c70d1b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:53:41 2016 -0800 chipmunk autogenerated files commit 66c71bfa3aaab04abf25f284e2e76ce2a74a98de Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:47:41 2016 -0800 compatibility both in JS (to reduce space) and in C for (C++ users) commit 0f9ffa0a8ab23a19e1f10b04e6987c2288764b1f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:10:02 2016 -0800 mooooore fixes commit 9ab23014093677e8eda69b105f50410b8c792aa3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:30:58 2016 -0800 doesn't crash with collision handler commit 69275a16817a038244bbaaff9e82a011b6729cb2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:16:29 2016 -0800 adds missing space functions commit a6b97bbc76cb9ab293356bb7451cfa858353f589 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 22:22:27 2016 -0800 queries... better commit 3442bceca64f5a0ddbbbb1a288146a2a61d87632 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 19:48:41 2016 -0800 adds more missing functions fixes other chipmunk JS issues commit 3797a033896d059da58a05ce0de832ed9c150eff Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 18:30:21 2016 -0800 yep... poly works ok commit d1bb57776891605b9d3e4fb90736c6869d96b944 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:29 2016 -0800 neede compat files commit 39ec518d4e089124d9a53fe3a8dce3aa0474c233 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:04 2016 -0800 query working! commit 71a8001fd6bc03ac674621f5da38a3f8778430b4 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:57:03 2016 -0800 almost there commit 9272fdcd06ba188db2fe5701fb2ac21476d54883 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:18:46 2016 -0800 fixes return values commit 7218778da846e1e36a510c0a19a5ee76f91db032 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 20:36:14 2016 -0800 cpMomentForSegment is manual since parameter 4 is optional in chipmunk 6, but not in 7 commit 98d5d3e23c2cdb941cc0b1f3ce8275990356e88d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 17:29:28 2016 -0800 yeah... process the arguments correctly works both for functions and auto_classes commit ce6a4fe3593b4f3b0fcdf11d12e297d789e0d96b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 16:49:00 2016 -0800 compiles and links fixes some issues with the queries. returns shapes instad of the queryInfo commit 3f879482dc6db86e45e4319bc802ccf19b52a46c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 15:03:18 2016 -0800 adds removeCollisionHandler and other fixes commit 32d825fc7bd323e144db6a1badc4a62420b6ea44 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Feb 18 20:59:24 2016 -0800 compiles... doesn't work yet commit bd64de81713fb2d7652a538d667d73f05f5d9320 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 17 18:17:39 2016 -0800 WIP: chipmunk bindings
2016-03-01 05:53:00 +08:00
}
2021-12-25 10:04:45 +08:00
else if (cpConstraintIsGrooveJoint(constraint))
2012-11-09 17:52:12 +08:00
{
2021-12-25 10:04:45 +08:00
cpVect a = cpvadd(cpBodyGetPosition(body_a),
cpvrotate(cpGrooveJointGetGrooveA(constraint), cpBodyGetRotation(body_a)));
cpVect b = cpvadd(cpBodyGetPosition(body_a),
cpvrotate(cpGrooveJointGetGrooveB(constraint), cpBodyGetRotation(body_a)));
cpVect c = cpvadd(cpBodyGetPosition(body_b),
cpvrotate(cpGrooveJointGetAnchorB(constraint), cpBodyGetRotation(body_b)));
2013-07-12 18:04:32 +08:00
renderer->drawDot(cpVert2Point(c), 3.0, CONSTRAINT_COLOR);
renderer->drawSegment(cpVert2Point(a), cpVert2Point(b), 1.0, CONSTRAINT_COLOR);
Squashed commit of the following: commit 36c2807d07848448c1fed86f4b119205048691bf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 13:11:40 2016 -0800 binary file 82 commit 9b7cd003b12faefd0522d12f765c027efb001ab2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:56:39 2016 -0800 fore multiple in windows phone 8.1 too commit daea8a3ef8d69915e7a9d962fd745a1103011bab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:50:45 2016 -0800 force multiple commit 0fbabdbf99974e95de083d79c7d6ae7cf735e4b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 10:44:40 2016 -0800 compiles commit f817766afcd0ffc4ca93f628d55fabc4b5a96ba5 Merge: 7b2cea3 8bf3d33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 09:37:24 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 7b2cea329a56ae2786428d39a499bc12ba3860e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sat Feb 27 01:11:13 2016 -0800 correct paths for win8.1 commit dcf1f046eb1e18474d6f94b2d7dc31fbf1b06cea Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 22:46:58 2016 -0800 projects works on win32 commit ab5b14c25ef0fdf224480302f9cb3cc01d5c360c Merge: 04377cc 9af2f4e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:57:10 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 04377cce7f46b2c2016ccc3855fc479c4f6aa516 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:26:55 2016 -0800 trying to make it compile on win32 commit 7703946d99e1cdc6a57f2ccb2a868818c1367291 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 10:28:12 2016 -0800 quick hack to make it compile... ...autogenerated files will fix it. commit ea35bf3a5894cb80b09ecd0a4a5408dcc19785f5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 09:20:59 2016 -0800 Squashed commit of the following: commit 487e52a7af7cdb40135fd3bd83b2efba0dfe6265 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 20:10:13 2016 -0800 compiles.. sort of commit a7990e2888d5ef1e43b811148b23c0b899105ab3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:55:24 2016 -0800 more chipmunk fixes commit 1174f6ec8201324161d7946af0f493b136a56690 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:36:15 2016 -0800 more chipmunk fixes commit 00ac2449ca0c35bd9184310d58e74aaa05bd1323 Merge: f942c5a 0594d3c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:29:27 2016 -0800 Merge branch 'chipmunk_v7_squashed' of github.com:ricardoquesada/cocos2d-x into chipmunk_v7_squashed commit f942c5a3cc7b24f3ac211d781be1b9c9d4ec0fd7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:28:51 2016 -0800 correct path for chipmunk commit 0594d3c4141d390b2566ea76101e383f15ebcaaf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 18:44:05 2016 -0800 compiles on ios commit 379503399c384ad77d25d68a2f83b71a829b1c04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:51:36 2016 -0800 chipmunk include fixes commit 95839fb7b406a32255853294b016d8c15aec1ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:09:04 2016 -0800 fixes for cmake + mac commit 39449ea3b7efccae2946785c1c11433d964ee480 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:51:25 2016 -0800 correct includes commit 98e97d7d2f00e6a78d040dcaf17e5a077e9a88c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:35:40 2016 -0800 fixes chipmunk with cmake commit 337f21f9466703722847635301d841ace9b757cb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:42:01 2016 -0800 updates android and linux projects commit 7111a9993b97f78cf73206804b25665c21a59ca8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:18:26 2016 -0800 cosmetic changes commit ce15038b8d2c0c7ebe31b4e1efe92646b7c70d1b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:53:41 2016 -0800 chipmunk autogenerated files commit 66c71bfa3aaab04abf25f284e2e76ce2a74a98de Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:47:41 2016 -0800 compatibility both in JS (to reduce space) and in C for (C++ users) commit 0f9ffa0a8ab23a19e1f10b04e6987c2288764b1f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:10:02 2016 -0800 mooooore fixes commit 9ab23014093677e8eda69b105f50410b8c792aa3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:30:58 2016 -0800 doesn't crash with collision handler commit 69275a16817a038244bbaaff9e82a011b6729cb2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:16:29 2016 -0800 adds missing space functions commit a6b97bbc76cb9ab293356bb7451cfa858353f589 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 22:22:27 2016 -0800 queries... better commit 3442bceca64f5a0ddbbbb1a288146a2a61d87632 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 19:48:41 2016 -0800 adds more missing functions fixes other chipmunk JS issues commit 3797a033896d059da58a05ce0de832ed9c150eff Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 18:30:21 2016 -0800 yep... poly works ok commit d1bb57776891605b9d3e4fb90736c6869d96b944 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:29 2016 -0800 neede compat files commit 39ec518d4e089124d9a53fe3a8dce3aa0474c233 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:04 2016 -0800 query working! commit 71a8001fd6bc03ac674621f5da38a3f8778430b4 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:57:03 2016 -0800 almost there commit 9272fdcd06ba188db2fe5701fb2ac21476d54883 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:18:46 2016 -0800 fixes return values commit 7218778da846e1e36a510c0a19a5ee76f91db032 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 20:36:14 2016 -0800 cpMomentForSegment is manual since parameter 4 is optional in chipmunk 6, but not in 7 commit 98d5d3e23c2cdb941cc0b1f3ce8275990356e88d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 17:29:28 2016 -0800 yeah... process the arguments correctly works both for functions and auto_classes commit ce6a4fe3593b4f3b0fcdf11d12e297d789e0d96b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 16:49:00 2016 -0800 compiles and links fixes some issues with the queries. returns shapes instad of the queryInfo commit 3f879482dc6db86e45e4319bc802ccf19b52a46c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 15:03:18 2016 -0800 adds removeCollisionHandler and other fixes commit 32d825fc7bd323e144db6a1badc4a62420b6ea44 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Feb 18 20:59:24 2016 -0800 compiles... doesn't work yet commit bd64de81713fb2d7652a538d667d73f05f5d9320 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 17 18:17:39 2016 -0800 WIP: chipmunk bindings
2016-03-01 05:53:00 +08:00
}
2021-12-25 10:04:45 +08:00
else if (cpConstraintIsDampedSpring(constraint))
2012-11-09 17:52:12 +08:00
{
2021-12-25 10:04:45 +08:00
cpDampedSpring* spring = (cpDampedSpring*)constraint;
cpVect a = cpTransformPoint(body_a->transform, spring->anchorA);
cpVect b = cpTransformPoint(body_b->transform, spring->anchorB);
renderer->drawDot(cpVert2Point(a), 3.0, CONSTRAINT_COLOR);
renderer->drawDot(cpVert2Point(b), 3.0, CONSTRAINT_COLOR);
cpVect delta = cpvsub(b, a);
cpFloat cos = delta.x;
cpFloat sin = delta.y;
cpFloat s = 1.0f / cpvlength(delta);
cpVect r1 = cpv(cos, -sin * s);
cpVect r2 = cpv(sin, cos * s);
2021-12-25 10:04:45 +08:00
cpVect* verts = (cpVect*)alloca(spring_count * sizeof(cpVect));
for (int i = 0; i < spring_count; i++)
{
cpVect v = spring_verts[i];
verts[i] = cpv(cpvdot(v, r1) + a.x, cpvdot(v, r2) + a.y);
}
2021-12-25 10:04:45 +08:00
for (int i = 0; i < spring_count - 1; i++)
{
renderer->drawSegment(cpVert2Point(verts[i]), cpVert2Point(verts[i + 1]), 1.0, CONSTRAINT_COLOR);
}
Squashed commit of the following: commit 36c2807d07848448c1fed86f4b119205048691bf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 13:11:40 2016 -0800 binary file 82 commit 9b7cd003b12faefd0522d12f765c027efb001ab2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:56:39 2016 -0800 fore multiple in windows phone 8.1 too commit daea8a3ef8d69915e7a9d962fd745a1103011bab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:50:45 2016 -0800 force multiple commit 0fbabdbf99974e95de083d79c7d6ae7cf735e4b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 10:44:40 2016 -0800 compiles commit f817766afcd0ffc4ca93f628d55fabc4b5a96ba5 Merge: 7b2cea3 8bf3d33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 09:37:24 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 7b2cea329a56ae2786428d39a499bc12ba3860e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sat Feb 27 01:11:13 2016 -0800 correct paths for win8.1 commit dcf1f046eb1e18474d6f94b2d7dc31fbf1b06cea Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 22:46:58 2016 -0800 projects works on win32 commit ab5b14c25ef0fdf224480302f9cb3cc01d5c360c Merge: 04377cc 9af2f4e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:57:10 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 04377cce7f46b2c2016ccc3855fc479c4f6aa516 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:26:55 2016 -0800 trying to make it compile on win32 commit 7703946d99e1cdc6a57f2ccb2a868818c1367291 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 10:28:12 2016 -0800 quick hack to make it compile... ...autogenerated files will fix it. commit ea35bf3a5894cb80b09ecd0a4a5408dcc19785f5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 09:20:59 2016 -0800 Squashed commit of the following: commit 487e52a7af7cdb40135fd3bd83b2efba0dfe6265 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 20:10:13 2016 -0800 compiles.. sort of commit a7990e2888d5ef1e43b811148b23c0b899105ab3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:55:24 2016 -0800 more chipmunk fixes commit 1174f6ec8201324161d7946af0f493b136a56690 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:36:15 2016 -0800 more chipmunk fixes commit 00ac2449ca0c35bd9184310d58e74aaa05bd1323 Merge: f942c5a 0594d3c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:29:27 2016 -0800 Merge branch 'chipmunk_v7_squashed' of github.com:ricardoquesada/cocos2d-x into chipmunk_v7_squashed commit f942c5a3cc7b24f3ac211d781be1b9c9d4ec0fd7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:28:51 2016 -0800 correct path for chipmunk commit 0594d3c4141d390b2566ea76101e383f15ebcaaf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 18:44:05 2016 -0800 compiles on ios commit 379503399c384ad77d25d68a2f83b71a829b1c04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:51:36 2016 -0800 chipmunk include fixes commit 95839fb7b406a32255853294b016d8c15aec1ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:09:04 2016 -0800 fixes for cmake + mac commit 39449ea3b7efccae2946785c1c11433d964ee480 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:51:25 2016 -0800 correct includes commit 98e97d7d2f00e6a78d040dcaf17e5a077e9a88c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:35:40 2016 -0800 fixes chipmunk with cmake commit 337f21f9466703722847635301d841ace9b757cb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:42:01 2016 -0800 updates android and linux projects commit 7111a9993b97f78cf73206804b25665c21a59ca8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:18:26 2016 -0800 cosmetic changes commit ce15038b8d2c0c7ebe31b4e1efe92646b7c70d1b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:53:41 2016 -0800 chipmunk autogenerated files commit 66c71bfa3aaab04abf25f284e2e76ce2a74a98de Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:47:41 2016 -0800 compatibility both in JS (to reduce space) and in C for (C++ users) commit 0f9ffa0a8ab23a19e1f10b04e6987c2288764b1f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:10:02 2016 -0800 mooooore fixes commit 9ab23014093677e8eda69b105f50410b8c792aa3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:30:58 2016 -0800 doesn't crash with collision handler commit 69275a16817a038244bbaaff9e82a011b6729cb2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:16:29 2016 -0800 adds missing space functions commit a6b97bbc76cb9ab293356bb7451cfa858353f589 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 22:22:27 2016 -0800 queries... better commit 3442bceca64f5a0ddbbbb1a288146a2a61d87632 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 19:48:41 2016 -0800 adds more missing functions fixes other chipmunk JS issues commit 3797a033896d059da58a05ce0de832ed9c150eff Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 18:30:21 2016 -0800 yep... poly works ok commit d1bb57776891605b9d3e4fb90736c6869d96b944 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:29 2016 -0800 neede compat files commit 39ec518d4e089124d9a53fe3a8dce3aa0474c233 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:04 2016 -0800 query working! commit 71a8001fd6bc03ac674621f5da38a3f8778430b4 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:57:03 2016 -0800 almost there commit 9272fdcd06ba188db2fe5701fb2ac21476d54883 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:18:46 2016 -0800 fixes return values commit 7218778da846e1e36a510c0a19a5ee76f91db032 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 20:36:14 2016 -0800 cpMomentForSegment is manual since parameter 4 is optional in chipmunk 6, but not in 7 commit 98d5d3e23c2cdb941cc0b1f3ce8275990356e88d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 17:29:28 2016 -0800 yeah... process the arguments correctly works both for functions and auto_classes commit ce6a4fe3593b4f3b0fcdf11d12e297d789e0d96b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 16:49:00 2016 -0800 compiles and links fixes some issues with the queries. returns shapes instad of the queryInfo commit 3f879482dc6db86e45e4319bc802ccf19b52a46c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 15:03:18 2016 -0800 adds removeCollisionHandler and other fixes commit 32d825fc7bd323e144db6a1badc4a62420b6ea44 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Feb 18 20:59:24 2016 -0800 compiles... doesn't work yet commit bd64de81713fb2d7652a538d667d73f05f5d9320 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 17 18:17:39 2016 -0800 WIP: chipmunk bindings
2016-03-01 05:53:00 +08:00
}
2012-11-09 17:52:12 +08:00
else
{
CCLOG("Cannot draw constraint");
Squashed commit of the following: commit 36c2807d07848448c1fed86f4b119205048691bf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 13:11:40 2016 -0800 binary file 82 commit 9b7cd003b12faefd0522d12f765c027efb001ab2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:56:39 2016 -0800 fore multiple in windows phone 8.1 too commit daea8a3ef8d69915e7a9d962fd745a1103011bab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 12:50:45 2016 -0800 force multiple commit 0fbabdbf99974e95de083d79c7d6ae7cf735e4b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 10:44:40 2016 -0800 compiles commit f817766afcd0ffc4ca93f628d55fabc4b5a96ba5 Merge: 7b2cea3 8bf3d33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 29 09:37:24 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 7b2cea329a56ae2786428d39a499bc12ba3860e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sat Feb 27 01:11:13 2016 -0800 correct paths for win8.1 commit dcf1f046eb1e18474d6f94b2d7dc31fbf1b06cea Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 22:46:58 2016 -0800 projects works on win32 commit ab5b14c25ef0fdf224480302f9cb3cc01d5c360c Merge: 04377cc 9af2f4e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:57:10 2016 -0800 Merge branch 'v3' into chipmunk_v7_2 commit 04377cce7f46b2c2016ccc3855fc479c4f6aa516 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 26 21:26:55 2016 -0800 trying to make it compile on win32 commit 7703946d99e1cdc6a57f2ccb2a868818c1367291 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 10:28:12 2016 -0800 quick hack to make it compile... ...autogenerated files will fix it. commit ea35bf3a5894cb80b09ecd0a4a5408dcc19785f5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 24 09:20:59 2016 -0800 Squashed commit of the following: commit 487e52a7af7cdb40135fd3bd83b2efba0dfe6265 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 20:10:13 2016 -0800 compiles.. sort of commit a7990e2888d5ef1e43b811148b23c0b899105ab3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:55:24 2016 -0800 more chipmunk fixes commit 1174f6ec8201324161d7946af0f493b136a56690 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:36:15 2016 -0800 more chipmunk fixes commit 00ac2449ca0c35bd9184310d58e74aaa05bd1323 Merge: f942c5a 0594d3c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:29:27 2016 -0800 Merge branch 'chipmunk_v7_squashed' of github.com:ricardoquesada/cocos2d-x into chipmunk_v7_squashed commit f942c5a3cc7b24f3ac211d781be1b9c9d4ec0fd7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 19:28:51 2016 -0800 correct path for chipmunk commit 0594d3c4141d390b2566ea76101e383f15ebcaaf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 18:44:05 2016 -0800 compiles on ios commit 379503399c384ad77d25d68a2f83b71a829b1c04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:51:36 2016 -0800 chipmunk include fixes commit 95839fb7b406a32255853294b016d8c15aec1ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 17:09:04 2016 -0800 fixes for cmake + mac commit 39449ea3b7efccae2946785c1c11433d964ee480 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:51:25 2016 -0800 correct includes commit 98e97d7d2f00e6a78d040dcaf17e5a077e9a88c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 16:35:40 2016 -0800 fixes chipmunk with cmake commit 337f21f9466703722847635301d841ace9b757cb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:42:01 2016 -0800 updates android and linux projects commit 7111a9993b97f78cf73206804b25665c21a59ca8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 14:18:26 2016 -0800 cosmetic changes commit ce15038b8d2c0c7ebe31b4e1efe92646b7c70d1b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:53:41 2016 -0800 chipmunk autogenerated files commit 66c71bfa3aaab04abf25f284e2e76ce2a74a98de Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:47:41 2016 -0800 compatibility both in JS (to reduce space) and in C for (C++ users) commit 0f9ffa0a8ab23a19e1f10b04e6987c2288764b1f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 06:10:02 2016 -0800 mooooore fixes commit 9ab23014093677e8eda69b105f50410b8c792aa3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:30:58 2016 -0800 doesn't crash with collision handler commit 69275a16817a038244bbaaff9e82a011b6729cb2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Feb 23 05:16:29 2016 -0800 adds missing space functions commit a6b97bbc76cb9ab293356bb7451cfa858353f589 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 22:22:27 2016 -0800 queries... better commit 3442bceca64f5a0ddbbbb1a288146a2a61d87632 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 19:48:41 2016 -0800 adds more missing functions fixes other chipmunk JS issues commit 3797a033896d059da58a05ce0de832ed9c150eff Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 18:30:21 2016 -0800 yep... poly works ok commit d1bb57776891605b9d3e4fb90736c6869d96b944 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:29 2016 -0800 neede compat files commit 39ec518d4e089124d9a53fe3a8dce3aa0474c233 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Feb 22 17:28:04 2016 -0800 query working! commit 71a8001fd6bc03ac674621f5da38a3f8778430b4 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:57:03 2016 -0800 almost there commit 9272fdcd06ba188db2fe5701fb2ac21476d54883 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 21:18:46 2016 -0800 fixes return values commit 7218778da846e1e36a510c0a19a5ee76f91db032 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 20:36:14 2016 -0800 cpMomentForSegment is manual since parameter 4 is optional in chipmunk 6, but not in 7 commit 98d5d3e23c2cdb941cc0b1f3ce8275990356e88d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 17:29:28 2016 -0800 yeah... process the arguments correctly works both for functions and auto_classes commit ce6a4fe3593b4f3b0fcdf11d12e297d789e0d96b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 16:49:00 2016 -0800 compiles and links fixes some issues with the queries. returns shapes instad of the queryInfo commit 3f879482dc6db86e45e4319bc802ccf19b52a46c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Feb 19 15:03:18 2016 -0800 adds removeCollisionHandler and other fixes commit 32d825fc7bd323e144db6a1badc4a62420b6ea44 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Feb 18 20:59:24 2016 -0800 compiles... doesn't work yet commit bd64de81713fb2d7652a538d667d73f05f5d9320 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Feb 17 18:17:39 2016 -0800 WIP: chipmunk bindings
2016-03-01 05:53:00 +08:00
}
2012-11-09 17:52:12 +08:00
}
// implementation of PhysicsDebugNode
2012-11-09 17:52:12 +08:00
2021-12-25 10:04:45 +08:00
void PhysicsDebugNode::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
2012-11-09 17:52:12 +08:00
{
2021-12-25 10:04:45 +08:00
if (!_spacePtr)
2012-11-09 17:52:12 +08:00
{
return;
}
// clear the shapes information before draw current shapes.
DrawNode::clear();
cpSpaceEachShape(_spacePtr, (cpSpaceShapeIteratorFunc)DrawShape, this);
cpSpaceEachConstraint(_spacePtr, (cpSpaceConstraintIteratorFunc)DrawConstraint, this);
2021-12-25 10:04:45 +08:00
DrawNode::draw(renderer, transform, flags);
2012-11-09 17:52:12 +08:00
}
2021-12-25 10:04:45 +08:00
PhysicsDebugNode::PhysicsDebugNode() : _spacePtr(nullptr) {}
2012-11-09 17:52:12 +08:00
2021-12-25 10:04:45 +08:00
PhysicsDebugNode* PhysicsDebugNode::create(cpSpace* space)
2012-11-09 17:52:12 +08:00
{
2021-12-25 10:04:45 +08:00
PhysicsDebugNode* node = new PhysicsDebugNode();
2021-12-08 00:11:53 +08:00
node->init();
node->_spacePtr = space;
node->autorelease();
2012-11-09 17:52:12 +08:00
return node;
}
2021-12-25 10:04:45 +08:00
PhysicsDebugNode::~PhysicsDebugNode() {}
2012-11-09 17:52:12 +08:00
cpSpace* PhysicsDebugNode::getSpace() const
{
return _spacePtr;
}
2021-12-25 10:04:45 +08:00
void PhysicsDebugNode::setSpace(cpSpace* space)
{
_spacePtr = space;
}
NS_CC_EXT_END