Skip to main content

ssruntime_dart 7.0.0-beta.1 copy "ssruntime_dart: ^7.0.0-beta.1" to clipboard
ssruntime_dart: ^7.0.0-beta.1 copied to clipboard

dart:ffi bindings to the SpriteStudio runtime (libssruntime): loads .ssab and emits per-frame draw data. The renderer-agnostic core under ssplayer_flutter.

ssruntime_dart #

Pure-Dart dart:ffi bindings for the SpriteStudio-SDK runtime (the Brain, libssruntime): load a .ssab, advance time, and read back the per-frame SoA buffers and the FlatBuffers DrawBatch plan.

Layer 1 — no Flutter dependency, no renderer. This package computes what to draw and says nothing about how. ssplayer_flutter is the Flutter renderer built on it; a Flame game, a flutter_gpu backend or a headless Dart tool sit on it just as well.

The C-API is exposed as top-level @Native functions that resolve the libssruntime code asset bundled by hook/build.dart — no DynamicLibrary, no loader path, and no Rust toolchain on the consumer side. The hook prefers a locally built native/, and otherwise downloads the pinned SpriteStudio-SDK release and verifies it against that release's SHA256SUMS.

Install #

dart pub add ssruntime_dart

Needs Dart 3.10+ (native assets stable). Most apps get this package transitively through ssplayer_flutter and never name it.

Use #

import 'package:ssruntime_dart/ssruntime_dart.dart';

// On the web the Brain is a wasm module fetched at runtime; a no-op on native.
await loadSsRuntime();

final resource = ssRuntime.createResourceCopy(bytes);   // checks the "SSAB" identifier only

package:ssruntime_dart/framedata.dart and effect_draw_plan.dart carry the generated FlatBuffers accessors for the plan the Brain emits.

Notes #

  • ssRuntime is the whole API surface. The raw dart:ffi bindings are deliberately not re-exported: this barrel has to stay dart:ffi-free so a layer above it can compile for the web, where the backend is dart:js_interop over the SDK's wasm build.
  • Every buffer is a borrow, valid only until the next update. Read the frame data before advancing, and keep the .ssab bytes alive as long as the resource that was built from them.
  • Never re-implement FNV-1a for texture keys. The pack carries the hashes the draw plan refers to; use them.

More #

0
likes
140
points
71
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

dart:ffi bindings to the SpriteStudio runtime (libssruntime): loads .ssab and emits per-frame draw data. The renderer-agnostic core under ssplayer_flutter.

Repository (GitHub)
View/report issues
Contributing

Topics

#spritestudio #animation #ffi #rust #runtime

License

BSD-3-Clause (license)

Dependencies

archive, code_assets, crypto, ffi, flat_buffers, hooks

More

Packages that depend on ssruntime_dart