MCPcopy
hub / github.com/KilledByAPixel/LittleJS / renderDebugInfo

Method renderDebugInfo

src/engineObject.js:535–550  ·  view source on GitHub ↗

Render debug info for this object

()

Source from the content-addressed store, hash-verified

533
534 /** Render debug info for this object */
535 renderDebugInfo()
536 {
537 if (!debug) return;
538
539 // check if there is anything to show
540 const hasPhysics = this.collideTiles || this.collideSolidObjects || this.isSolid;
541 if (!hasPhysics && !this.parent) return;
542
543 // show object info for debugging
544 const size = vec2(max(this.size.x, .2), max(this.size.y, .2));
545 const color = rgb(this.collideTiles?1:0, this.collideSolidObjects?1:0, this.isSolid?1:0, .5);
546 debugRect(this.pos, size, color, 0, this.angle, hasPhysics);
547 if (this.parent)
548 debugRect(this.pos, size.scale(.8), rgb(1,1,1,.5), 0, this.angle);
549 this.parent && debugLine(this.pos, this.parent.pos, rgb(1,1,1,.5), .5);
550 }
551}

Callers 1

debugRenderFunction · 0.45

Calls 5

vec2Function · 0.85
rgbFunction · 0.85
debugRectFunction · 0.70
debugLineFunction · 0.70
scaleMethod · 0.45

Tested by

no test coverage detected