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

Method drawFixtures

plugins/box2d.js:122–139  ·  view source on GitHub ↗

Draws all this object's fixtures * @param {Color} [color] * @param {Color} [lineColor] * @param {number} [lineWidth] * @param {boolean} [useWebGL=glEnable] * @param {CanvasRenderingContext2D} [context]

(color=WHITE, lineColor=BLACK, lineWidth=.1, useWebGL, context)

Source from the content-addressed store, hash-verified

120 * @param {boolean} [useWebGL=glEnable]
121 * @param {CanvasRenderingContext2D} [context] */
122 drawFixtures(color=WHITE, lineColor=BLACK, lineWidth=.1, useWebGL, context)
123 {
124 // draw non-edge fixtures
125 this.getFixtureList().forEach((fixture)=>
126 {
127 const shape = box2d.castShapeObject(fixture.GetShape());
128 if (shape.GetType() !== box2d.instance.b2Shape.e_edge)
129 {
130 box2d.drawFixture(fixture, this.pos, this.angle, color, lineColor, lineWidth, useWebGL, context);
131 }
132 });
133
134 // draw edges using a single draw line for better connections
135 this.edgeLists.forEach(points=>
136 drawLineList(points, lineWidth, lineColor, false, this.pos, this.angle));
137 this.edgeLoops.forEach(points=>
138 drawLineList(points, lineWidth, lineColor, true, this.pos, this.angle));
139 }
140
141 ///////////////////////////////////////////////////////////////////////////////
142 // physics contact callbacks

Callers 2

renderMethod · 0.95
renderDebugInfoMethod · 0.95

Calls 4

getFixtureListMethod · 0.95
drawLineListFunction · 0.85
castShapeObjectMethod · 0.80
drawFixtureMethod · 0.80

Tested by

no test coverage detected