// c:\Users\benji\OneDrive\Documents\Source Code\sandgame\renderer.js import { ctx, canvas, grid, cols, rows, cellSize } from './state.js'; import { config } from './config.js'; export function draw() { ctx.fillStyle = '#111'; ctx.fillRect(0, 0, canvas.width, canvas.height); const style = config.visual.style; const radius = cellSize / 2; if (style === 'fuzzy') { ctx.filter = 'blur(2px)'; } // Draw Grid for (let i = 0; i < cols; i++) { for (let j = 0; j < rows; j++) { if (grid[i][j]) { ctx.fillStyle = grid[i][j].color; const x = i * cellSize; const y = j * cellSize; if (style === 'bloby') { ctx.beginPath(); ctx.arc(x + radius, y + radius, radius, 0, 2 * Math.PI); ctx.fill(); } else { // blocky ctx.fillRect(x, y, cellSize, cellSize); } } } } if (style === 'fuzzy') { ctx.filter = 'none'; } }