@@ -372,35 +372,8 @@ public virtual void Step(Settings settings)
372372 {
373373 timeStep = 0.0f ;
374374 }
375-
376- if ( m_context . draw . m_showUI )
377- {
378- m_context . draw . DrawString ( 5 , m_textLine , "****PAUSED****" ) ;
379- m_textLine += m_textIncrement ;
380- }
381375 }
382376
383- m_context . draw . m_debugDraw . drawingBounds = m_context . camera . GetViewBounds ( ) ;
384- m_context . draw . m_debugDraw . useDrawingBounds = settings . useCameraBounds ;
385-
386- // todo testing
387- // b2Transform t1 = {m_context.g_draw.m_debugDraw.drawingBounds.lowerBound, b2Rot_identity};
388- // b2Transform t2 = {m_context.g_draw.m_debugDraw.drawingBounds.upperBound, b2Rot_identity};
389- // m_context.g_draw.DrawSolidCircle(ref t1, b2Vec2_zero, 1.0f, {1.0f, 0.0f, 0.0f, 1.0f});
390- // m_context.g_draw.DrawSolidCircle(ref t2, b2Vec2_zero, 1.0f, {1.0f, 0.0f, 0.0f, 1.0f});
391-
392- m_context . draw . m_debugDraw . drawShapes = settings . drawShapes ;
393- m_context . draw . m_debugDraw . drawJoints = settings . drawJoints ;
394- m_context . draw . m_debugDraw . drawJointExtras = settings . drawJointExtras ;
395- m_context . draw . m_debugDraw . drawAABBs = settings . drawAABBs ;
396- m_context . draw . m_debugDraw . drawMass = settings . drawMass ;
397- m_context . draw . m_debugDraw . drawBodyNames = settings . drawBodyNames ;
398- m_context . draw . m_debugDraw . drawContacts = settings . drawContactPoints ;
399- m_context . draw . m_debugDraw . drawGraphColors = settings . drawGraphColors ;
400- m_context . draw . m_debugDraw . drawContactNormals = settings . drawContactNormals ;
401- m_context . draw . m_debugDraw . drawContactImpulses = settings . drawContactImpulses ;
402- m_context . draw . m_debugDraw . drawFrictionImpulses = settings . drawFrictionImpulses ;
403-
404377 b2World_EnableSleeping ( m_worldId , settings . enableSleep ) ;
405378 b2World_EnableWarmStarting ( m_worldId , settings . enableWarmStarting ) ;
406379 b2World_EnableContinuous ( m_worldId , settings . enableContinuous ) ;
@@ -411,49 +384,11 @@ public virtual void Step(Settings settings)
411384 m_taskCount = 0 ;
412385 }
413386
414- b2World_Draw ( m_worldId , m_context . draw . m_debugDraw ) ;
415-
416387 if ( timeStep > 0.0f )
417388 {
418389 ++ m_stepCount ;
419390 }
420391
421- if ( settings . drawCounters )
422- {
423- B2Counters s = b2World_GetCounters ( m_worldId ) ;
424-
425- m_context . draw . DrawString ( 5 , m_textLine , $ "bodies/shapes/contacts/joints = { s . bodyCount } /{ s . shapeCount } /{ s . contactCount } /{ s . jointCount } ") ;
426- m_textLine += m_textIncrement ;
427-
428- m_context . draw . DrawString ( 5 , m_textLine , $ "islands/tasks = { s . islandCount } /{ s . taskCount } ") ;
429- m_textLine += m_textIncrement ;
430-
431- m_context . draw . DrawString ( 5 , m_textLine , $ "tree height static/movable = { s . staticTreeHeight } /{ s . treeHeight } ") ;
432- m_textLine += m_textIncrement ;
433-
434- int totalCount = 0 ;
435- var buffer = new StringBuilder ( ) ;
436- Debug . Assert ( s . colorCounts . Length == 12 ) ;
437-
438- // todo fix this
439- buffer . Append ( "colors: " ) ;
440- for ( int i = 0 ; i < 12 ; ++ i )
441- {
442- buffer . Append ( $ "{ s . colorCounts [ i ] } /") ;
443- totalCount += s . colorCounts [ i ] ;
444- }
445-
446- buffer . Append ( $ "[{ totalCount } ]") ;
447- m_context . draw . DrawString ( 5 , m_textLine , buffer . ToString ( ) ) ;
448- m_textLine += m_textIncrement ;
449-
450- m_context . draw . DrawString ( 5 , m_textLine , $ "stack allocator size = { s . stackUsed / 1024 } K") ;
451- m_textLine += m_textIncrement ;
452-
453- m_context . draw . DrawString ( 5 , m_textLine , $ "total allocation = { s . byteCount / 1024 } K") ;
454- m_textLine += m_textIncrement ;
455- }
456-
457392 // Track maximum profile times
458393 {
459394 B2Profile p = b2World_GetProfile ( m_worldId ) ;
@@ -507,6 +442,73 @@ public virtual void Step(Settings settings)
507442
508443 public virtual void Draw ( Settings settings )
509444 {
445+ if ( settings . pause )
446+ {
447+ if ( m_context . draw . m_showUI )
448+ {
449+ m_context . draw . DrawString ( 5 , m_textLine , "****PAUSED****" ) ;
450+ m_textLine += m_textIncrement ;
451+ }
452+ }
453+
454+ m_context . draw . m_debugDraw . drawingBounds = m_context . camera . GetViewBounds ( ) ;
455+ m_context . draw . m_debugDraw . useDrawingBounds = settings . useCameraBounds ;
456+
457+ // todo testing
458+ // b2Transform t1 = {m_context.g_draw.m_debugDraw.drawingBounds.lowerBound, b2Rot_identity};
459+ // b2Transform t2 = {m_context.g_draw.m_debugDraw.drawingBounds.upperBound, b2Rot_identity};
460+ // m_context.g_draw.DrawSolidCircle(ref t1, b2Vec2_zero, 1.0f, {1.0f, 0.0f, 0.0f, 1.0f});
461+ // m_context.g_draw.DrawSolidCircle(ref t2, b2Vec2_zero, 1.0f, {1.0f, 0.0f, 0.0f, 1.0f});
462+
463+ m_context . draw . m_debugDraw . drawShapes = settings . drawShapes ;
464+ m_context . draw . m_debugDraw . drawJoints = settings . drawJoints ;
465+ m_context . draw . m_debugDraw . drawJointExtras = settings . drawJointExtras ;
466+ m_context . draw . m_debugDraw . drawAABBs = settings . drawAABBs ;
467+ m_context . draw . m_debugDraw . drawMass = settings . drawMass ;
468+ m_context . draw . m_debugDraw . drawBodyNames = settings . drawBodyNames ;
469+ m_context . draw . m_debugDraw . drawContacts = settings . drawContactPoints ;
470+ m_context . draw . m_debugDraw . drawGraphColors = settings . drawGraphColors ;
471+ m_context . draw . m_debugDraw . drawContactNormals = settings . drawContactNormals ;
472+ m_context . draw . m_debugDraw . drawContactImpulses = settings . drawContactImpulses ;
473+ m_context . draw . m_debugDraw . drawFrictionImpulses = settings . drawFrictionImpulses ;
474+
475+ b2World_Draw ( m_worldId , m_context . draw . m_debugDraw ) ;
476+
477+ if ( settings . drawCounters )
478+ {
479+ B2Counters s = b2World_GetCounters ( m_worldId ) ;
480+
481+ m_context . draw . DrawString ( 5 , m_textLine , $ "bodies/shapes/contacts/joints = { s . bodyCount } /{ s . shapeCount } /{ s . contactCount } /{ s . jointCount } ") ;
482+ m_textLine += m_textIncrement ;
483+
484+ m_context . draw . DrawString ( 5 , m_textLine , $ "islands/tasks = { s . islandCount } /{ s . taskCount } ") ;
485+ m_textLine += m_textIncrement ;
486+
487+ m_context . draw . DrawString ( 5 , m_textLine , $ "tree height static/movable = { s . staticTreeHeight } /{ s . treeHeight } ") ;
488+ m_textLine += m_textIncrement ;
489+
490+ int totalCount = 0 ;
491+ var buffer = new StringBuilder ( ) ;
492+ Debug . Assert ( s . colorCounts . Length == 12 ) ;
493+
494+ // todo fix this
495+ buffer . Append ( "colors: " ) ;
496+ for ( int i = 0 ; i < 12 ; ++ i )
497+ {
498+ buffer . Append ( $ "{ s . colorCounts [ i ] } /") ;
499+ totalCount += s . colorCounts [ i ] ;
500+ }
501+
502+ buffer . Append ( $ "[{ totalCount } ]") ;
503+ m_context . draw . DrawString ( 5 , m_textLine , buffer . ToString ( ) ) ;
504+ m_textLine += m_textIncrement ;
505+
506+ m_context . draw . DrawString ( 5 , m_textLine , $ "stack allocator size = { s . stackUsed / 1024 } K") ;
507+ m_textLine += m_textIncrement ;
508+
509+ m_context . draw . DrawString ( 5 , m_textLine , $ "total allocation = { s . byteCount / 1024 } K") ;
510+ m_textLine += m_textIncrement ;
511+ }
510512 }
511513
512514 public void ShiftOrigin ( B2Vec2 newOrigin )
0 commit comments