MCPcopy Index your code
hub / github.com/KilledByAPixel/LittleJS / render

Method render

plugins/uiSystem.js:1271–1288  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1269 this.onChange();
1270 }
1271 render()
1272 {
1273 super.render();
1274 if (this.checked)
1275 {
1276 const p = this.cornerRadius / min(this.size.x, this.size.y) * 2;
1277 const length = lerp(1, 2**.5/2, p) / 2;
1278 let s = this.size.scale(length);
1279 uiSystem.drawLine(this.pos.add(s.multiply(vec2(-1))), this.pos.add(s.multiply(vec2(1))), this.lineWidth, this.lineColor);
1280 uiSystem.drawLine(this.pos.add(s.multiply(vec2(-1,1))), this.pos.add(s.multiply(vec2(1,-1))), this.lineWidth, this.lineColor);
1281 }
1282
1283 // draw the text next to the checkbox
1284 const textSize = this.getTextSize();
1285 const pos = this.pos.add(vec2(this.size.x,0));
1286 uiSystem.drawText(this.text, pos, textSize,
1287 this.textColor, this.textLineWidth, this.textLineColor, 'left', this.font, this.fontStyle, false, this.textShadow);
1288 }
1289}
1290
1291///////////////////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 9

lerpFunction · 0.85
vec2Function · 0.85
drawLineMethod · 0.80
getTextSizeMethod · 0.80
renderMethod · 0.45
scaleMethod · 0.45
addMethod · 0.45
multiplyMethod · 0.45
drawTextMethod · 0.45

Tested by

no test coverage detected