updateGame method

void updateGame(
  1. double deltaSeconds, {
  2. Flix3DGameInput input = const Flix3DGameInput(),
})

Advances native gameplay and applies movement and camera input.

Implementation

void updateGame(
  double deltaSeconds, {
  Flix3DGameInput input = const Flix3DGameInput(),
}) {
  _ensureNotDisposed();
  if (!deltaSeconds.isFinite || deltaSeconds < 0) {
    throw ArgumentError.value(
      deltaSeconds,
      'deltaSeconds',
      'Must be finite and non-negative.',
    );
  }
  if (!input.isValid) {
    throw ArgumentError.value(input, 'input', 'Input values must be finite.');
  }
  if (!isInitialized) {
    throw StateError('Initialize the native runtime before updating it.');
  }
  if (_gameUpdate(
        _handle,
        deltaSeconds,
        input.forward,
        input.right,
        input.lookDeltaX,
        input.lookDeltaY,
        input.jumpPressed ? 1 : 0,
      ) ==
      0) {
    throw StateError('The native game loop rejected the update.');
  }
}