(btn: VirtualButton)
| 241 | } |
| 242 | |
| 243 | export 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 |
nothing calls this directly
no test coverage detected