MCPcopy Create free account
hub / github.com/axmolengine/axmol / Step

Method Step

tests/cpp-tests/Source/Box2DTestBed/test.cpp:287–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287void Test::Step(Settings& settings)
288{
289 float timeStep = settings.m_hertz > 0.0f ? 1.0f / settings.m_hertz : float(0.0f);
290
291 if (settings.m_pause)
292 {
293 if (settings.m_singleStep)
294 {
295 settings.m_singleStep = 0;
296 }
297 else
298 {
299 timeStep = 0.0f;
300 }
301
302 DrawString(5, m_textLine, "****PAUSED****");
303 }
304
305 uint32 flags = 0;
306 flags += settings.m_drawShapes * b2Draw::e_shapeBit;
307 flags += settings.m_drawJoints * b2Draw::e_jointBit;
308 flags += settings.m_drawAABBs * b2Draw::e_aabbBit;
309 flags += settings.m_drawCOMs * b2Draw::e_centerOfMassBit;
310 g_debugDraw.SetFlags(flags);
311
312 m_world->SetAllowSleeping(settings.m_enableSleep);
313 m_world->SetWarmStarting(settings.m_enableWarmStarting);
314 m_world->SetContinuousPhysics(settings.m_enableContinuous);
315 m_world->SetSubStepping(settings.m_enableSubStepping);
316
317 m_pointCount = 0;
318
319 m_world->Step(timeStep, settings.m_velocityIterations, settings.m_positionIterations);
320
321 m_world->DebugDraw();
322
323 if (timeStep > 0.0f)
324 {
325 ++m_stepCount;
326 }
327
328 if (settings.m_drawStats)
329 {
330 int32 bodyCount = m_world->GetBodyCount();
331 int32 contactCount = m_world->GetContactCount();
332 int32 jointCount = m_world->GetJointCount();
333 DrawString(5, m_textLine, "bodies/contacts/joints = %d/%d/%d", bodyCount, contactCount, jointCount);
334
335 int32 proxyCount = m_world->GetProxyCount();
336 int32 height = m_world->GetTreeHeight();
337 int32 balance = m_world->GetTreeBalance();
338 float quality = m_world->GetTreeQuality();
339 DrawString(5, m_textLine, "proxies/height/balance/quality = %d/%d/%d/%g", proxyCount, height, balance, quality);
340 }
341
342 // Track maximum profile times
343 {
344 const b2Profile& p = m_world->GetProfile();

Callers 2

updateMethod · 0.45
updateMethod · 0.45

Calls 15

b2MaxFunction · 0.85
b2CrossFunction · 0.85
SetFlagsMethod · 0.80
SetAllowSleepingMethod · 0.80
GetBodyCountMethod · 0.80
GetContactCountMethod · 0.80
GetJointCountMethod · 0.80
DrawPointMethod · 0.80
DrawSegmentMethod · 0.80
b2ColorFunction · 0.50
DebugDrawMethod · 0.45
GetProxyCountMethod · 0.45

Tested by

no test coverage detected