renderTree method

  1. @override
void renderTree(
  1. Canvas canvas
)
override

Implementation

@override
void renderTree(Canvas canvas) {
  if (!_containColor) {
    return;
  }
  canvas.saveLayer(bounds, paint);
  canvas.drawColor(color!, BlendMode.dstATop);
  for (final light in _visibleLight) {
    final config = light.lightingConfig;
    if (config == null || !light.lightingEnabled) {
      continue;
    }
    config.update(_dtUpdate);
    canvas.save();

    canvas.scale(gameRef.camera.zoom);
    final tl = gameRef.camera.topleft;
    canvas.translate(-tl.x, -tl.y);

    if (config.type is CircleLightingType) {
      _drawCircle(canvas, light);
    }

    if (config.type is ArcLightingType) {
      _drawArc(canvas, light);
    }
    canvas.restore();
  }
  canvas.restore();
}