flim 0.2.1 copy "flim: ^0.2.1" to clipboard
flim: ^0.2.1 copied to clipboard

outdated

minimal data-driven sprite render and animation lib for Flutter

flim ✨ #

minimal data-driven sprite render lib for Flutter

Features #

  • sprite and animated sprites with transforms
  • buffered sprite rendering using Canvas.drawAtlas (fast!)
  • data-driven; load sprites and animations as json
  • abstractions for game, render-loop, widgets and more
  • generic asset cache used for images, json and more
  • minimal and loosely coupled Flutter package

Usage #

Here is a short summary of the library.

Also see example.

Game and widgets

Inherit from Game and override methods to initialize, update and render, Sprites and AnimatedSprites, and respond to events. Add your Game to a GameWidget.

Use an AnimatedSpriteGame for a single AnimatedSprite, or SpriteWidget for a single Sprite.

A RenderLoop in GameRenderBox updates your game at ~60 fps and gives you delta time since previous update.

Initialize assets

Initialize your sprite objects in Game.initialize, and return the Game as a future.

AssetCache, or one of its sub-classes, is used for loading and caching images, json files and more.

Load (and cache) Sprite and AnimatedSprite (or other objects) from json assets by calling Sprite.loadJson, AnimatedSprite.loadJson or JsonAssets.instance.load. Or add them by code.

Load (and cache) images by calling Sprite.loadImage,AnimatedSprite.loadImages or ImageAssets.instance.load.

Render

Render sprites using a SpriteBatchMap (in most cases). Add sprites to it by calling add, then call SpriteBatchMap.render in Game.render.

Update animations using AnimatedSprite.update in Game.update. Then call SpriteBatchMap.clear before adding AnimatedSprite.sprite to a SpriteBatchMap.

Notes #

I'd like to keep this minimal, with focus on fast sprite rendering, so i won't be adding a lot of "game" features.

APIs will likely break (as i like to experiment).

Code and doc improvements are welcome :)

Inspired by Flame

6
likes
0
pub points
14%
popularity

Publisher

verified publisherapptakk.com

minimal data-driven sprite render and animation lib for Flutter

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flim