smolworld / src /js /panel.js
p3nGu1nZz's picture
✨ Implement physics engine and GUI components including panel drawing, text rendering, and scrollbar functionality; update configuration for improved performance
7e312e3
raw
history blame contribute delete
398 Bytes
export function drawPanel(ctx, x, y, width, height, margin = 2) {
// Draw margin/border
ctx.fillStyle = 'rgba(255, 255, 255, 0.5)';
ctx.fillRect(x, y, width, height);
// Draw background with margin
ctx.fillStyle = 'black';
ctx.globalAlpha = 1.0;
ctx.fillRect(
x + margin,
y + margin,
width - (margin * 2),
height - (margin * 2)
);
}