runRaylib function

Future<void> runRaylib(
  1. RaylibAppBase<Raylib> app, {
  2. String? nativeLibPath,
  3. bool silent = false,
})

Runs app on the native raylib backend until it closes.

Loads the native raylib shared library, searching upward from the current working directory for a folder named nativeLibPath (defaults to 'raylib-6.0/lib').

Set silent to suppress raylib's init/dispose log output.

Implementation

Future<void> runRaylib(RaylibAppBase<Raylib> app, {
  String? nativeLibPath,
  bool silent = false,
}) async {
  final rl = findRaylib(nativeLibPath ?? 'raylib-6.0/lib', silent: silent);
  app.init(rl);
  while (!app.shouldClose(rl)) {
    await app.loop(rl);
  }
  app.close(rl);
  app.dispose(rl);
}