drawTextureRegion method Null safety

void drawTextureRegion(
  1. {required TextureRegion textureRegion,
  2. required TransformData transform,
  3. required Vector2 position,
  4. required int priority,
  5. int? color,
  6. bool cameraRelative = true}
)

Implementation

void drawTextureRegion(
    {required TextureRegion textureRegion,
    required TransformData transform,
    required Vector2 position,
    required int priority,
    int? color,
    bool cameraRelative = true}) {
  var dx, dy;
  if (cameraRelative) {
    final focusPosition = systems.cameraSystem.focusPosition;
    dx = position.x - focusPosition.x + parameters.viewHalfWidth;
    dy = position.y - focusPosition.y + parameters.viewHalfHeight;
  } else {
    dx = position.x;
    dy = position.y;
  }
  _renderQueue.allocate().setSingle(
      priority: priority,
      data: transform,
      textureRegion: textureRegion,
      color: color,
      dx: dx,
      dy: dy);
}