MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / drawVirtualButton

Function drawVirtualButton

src/mobile/index.ts:243–256  ·  view source on GitHub ↗
(btn: VirtualButton)

Source from the content-addressed store, hash-verified

241}
242
243export function drawVirtualButton(btn: VirtualButton): void {
244 const bgColor: Color = btn.active
245 ? { r: 255, g: 255, b: 255, a: 120 }
246 : { r: 255, g: 255, b: 255, a: 60 };
247
248 drawCircle(btn.x, btn.y, btn.radius, bgColor);
249
250 if (btn.label) {
251 const fontSize = btn.radius * 0.8;
252 const textWidth = measureText(btn.label, fontSize);
253 const labelColor: Color = { r: 255, g: 255, b: 255, a: 200 };
254 drawText(btn.label, btn.x - textWidth / 2, btn.y - fontSize / 2, fontSize, labelColor);
255 }
256}
257
258// ============================================================
259// Convenience: unified movement input

Callers

nothing calls this directly

Calls 3

drawCircleFunction · 0.90
measureTextFunction · 0.90
drawTextFunction · 0.90

Tested by

no test coverage detected