@@ -91,7 +91,7 @@ cpBool ChipmunkDemoRightDown = cpFalse;
9191cpBool ChipmunkDemoLeftDown = cpFalse;
9292double ChipmunkDemoTime;
9393
94- cpBody* mouse_body = cpBodyNewKinematic();
94+ cpBody* mouse_body = cpBodyNewKinematic();
9595static cpConstraint* mouse_joint = nullptr ;
9696
9797char const * ChipmunkDemoMessageString = nullptr ;
@@ -102,7 +102,7 @@ cpShapeFilter NOT_GRABBABLE_FILTER = {CP_NO_GROUP, ~GRABBABLE_MASK_BIT, ~GRABBAB
102102
103103ax::DrawNode* drawCP = nullptr ;
104104
105- void ChipmunkDemoDefaultDrawImpl (cpSpace* space){};
105+ void ChipmunkDemoDefaultDrawImpl (cpSpace* space) {};
106106
107107void ChipmunkDebugDrawDot (cpFloat size, cpVect pos, cpSpaceDebugColor fillColor)
108108{
@@ -174,44 +174,6 @@ static int max_arbiters = 0;
174174static int max_points = 0 ;
175175static int max_constraints = 0 ;
176176
177- void ChipmunkTestBed::DrawInfo ()
178- {
179- int arbiters = _space->arbiters ->num ;
180- int points = 0 ;
181-
182- for (int i = 0 ; i < arbiters; i++)
183- points += ((cpArbiter*)(_space->arbiters ->arr [i]))->count ;
184-
185- int constraints = (_space->constraints ->num + points) * _space->iterations ;
186-
187- max_arbiters = arbiters > max_arbiters ? arbiters : max_arbiters;
188- max_points = points > max_points ? points : max_points;
189- max_constraints = constraints > max_constraints ? constraints : max_constraints;
190-
191- char buffer[1024 ];
192- constexpr auto format =
193- " Arbiters: {} ({}) - "
194- " Contact Points: {} ({})\n "
195- " Other Constraints: {}, Iterations: {}\n "
196- " Constraints x Iterations: {} ({})\n "
197- " Time:{:5.2f}s, KE:{:5.2e}" sv;
198-
199- cpArray* bodies = _space->dynamicBodies ;
200- cpFloat ke = 0 .0f ;
201- for (int i = 0 ; i < bodies->num ; i++)
202- {
203- cpBody* body = (cpBody*)bodies->arr [i];
204- if (body->m == INFINITY || body->i == INFINITY)
205- continue ;
206-
207- ke += body->m * cpvdot (body->v , body->v ) + body->i * body->w * body->w ;
208- }
209-
210- auto msg = fmt::format_to_z (buffer, format, arbiters, max_arbiters, points, max_points, _space->constraints ->num , _space->iterations ,
211- constraints, max_constraints, ChipmunkDemoTime, (ke < 1e-10f ? 0 .0f : ke));
212-
213- drawInfo->setString (msg);
214- }
215177
216178static char PrintStringBuffer[1024 * 8 ];
217179static char * PrintStringCursor;
@@ -308,9 +270,9 @@ ChipmunkTestBed::ChipmunkTestBed()
308270{
309271 // halx99: since axmol init scene default camera at 'initWithXXX' function, only change design size at scene
310272 // construct is ok see also: https://github.com/axmolengine/axmol/commit/581a7921554c09746616759d5a5ca6ce9d3eaa22
311- auto director = Director::getInstance ();
312- auto renderView = director->getRenderView ();
313- Size designSize (g_designSize.width * 0.85 , g_designSize.height * 0.85 );
273+ auto director = Director::getInstance ();
274+ auto renderView = director->getRenderView ();
275+ Size designSize (g_designSize.width * 1.5 , g_designSize.height * 1.5 );
314276 renderView->setDesignResolutionSize (designSize.width , designSize.height , ResolutionPolicy::SHOW_ALL);
315277
316278 // creating a keyboard event listener
@@ -395,11 +357,11 @@ void ChipmunkTestBed::initPhysics()
395357
396358void ChipmunkTestBed::update (float delta)
397359{
398- // #if AX_TARGET_PLATFORM == AX_PLATFORM_WIN32
399- // cpSpaceStep(_space, delta);
400- // #else
401- // cpHastySpaceStep(_space, delta);
402- // #endif
360+ // #if AX_TARGET_PLATFORM == AX_PLATFORM_WIN32
361+ // cpSpaceStep(_space, delta);
362+ // #else
363+ // cpHastySpaceStep(_space, delta);
364+ // #endif
403365}
404366
405367void ChipmunkTestBed::createResetButton ()
@@ -484,8 +446,8 @@ bool ChipmunkTestBed::onMouseUp(Event* event)
484446
485447bool ChipmunkTestBed::onMouseMove (Event* event)
486448{
487- EventMouse* e = (EventMouse*)event;
488- auto pt = e->getLocation ();
449+ EventMouse* e = (EventMouse*)event;
450+ auto pt = e->getLocation ();
489451 ChipmunkDemoMouse.x = pt.x - physicsDebugNodeOffset.x ;
490452 ChipmunkDemoMouse.y = pt.y - physicsDebugNodeOffset.y ;
491453
@@ -502,7 +464,6 @@ void ChipmunkTestBed::updateInit(ChipmunkDemo tt)
502464 drawCP->clear ();
503465 updateMouseBody ();
504466 ChipmunkDemoTime += tt.timestep ;
505- ChipmunkTestBed::DrawInfo ();
506467 tt.updateFunc (_space, tt.timestep );
507468}
508469
0 commit comments