Skip to content

Sprites: atlases, frames, animations and a batch drawn into a Canvas #4

Closed
8 of 8 issues completed

Description

@houko

Context

Part of nsgo-dev/nsgo#1047. NSGo's Canvas draws part of an image with Drawing.DrawImageFrom, one op per sprite, and nsgo-dev/nsgo#1053 measures that and adds a batched Drawing.DrawAtlas.

Proposal

  • Atlas: an image (core.ImageSource) and a table of named frames (rects), loadable from a YAML or the common JSON atlas formats exported by sprite packers (TexturePacker, Aseprite).
  • Sprite: position, origin, rotation, scale, flip, tint, alpha, z order, and the current frame.
  • Animation: frame sequences with per-frame durations, looping or once, advanced by update steps.
  • Batch: draws the sprites of one atlas into a *core.Drawing, with DrawImageFrom now and one DrawAtlas call once Canvas: measure many sprites per frame, and add a batched DrawAtlas nsgo#1053 lands.

Acceptance

  • A batch of sprites draws the same picture as hand-written DrawImageFrom calls, checked by a canvas recording under nsgotest.
  • An Aseprite JSON export loads with its frame tags as animations.
  • 1000 moving sprites hold 60 fps on macOS, measured with --nsgo-fps.

Sub-issues

Sub-issues

8 of 8 Issues completed
Loading 8 sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions