debugDraw method

void debugDraw(
  1. Canvas canvas, {
  2. Vec2? position,
  3. AABB? cullArea,
})

Draws the grid data as colored rects. Tiles with a value smaller than 0 are skipped.

Implementation

void debugDraw(
  Canvas canvas, {
  Vec2? position,
  AABB? cullArea,
}) {
  final paint = Paint();
  forEachDrawArea(
    visit: (screenX, screenY, tile) {
      paint.color = debugPalette[tile % debugPalette.length];
      canvas.drawRect(
        Rect.fromLTWH(
          screenX,
          screenY,
          cellSize.toDouble(),
          cellSize.toDouble(),
        ),
        paint,
      );
    },
    position: position,
    cullArea: cullArea,
  );
}