#sprites #bevy #2d #tilemap #graphics

bevy_sprite_grid

draws sprites in a grid

6 releases (3 breaking)

0.5.0 Aug 1, 2022
0.4.0 Apr 16, 2022
0.3.11 Apr 11, 2022
0.3.0 Mar 16, 2022
0.2.0 Mar 15, 2022

#2203 in Game dev

21 downloads per month

MIT/Apache

29KB
560 lines

bevy sprite grid

Extremely basic crate that draws sprites in a grid.

SpriteGridPlugin has only one system. A SpriteGrid is a single entity with a SpriteGrid component and, like most Bevy renderables, Transform, GlobalTransform, ComputedVisibility and Visibility components.

Drawing is done by the built-in Bevy sprite renderer. No intermediate sprite entities are created.

It supports regular Bevy sprites, sprites from a TextureAtlas, or a mix of them, or it can just draw untextured quads if all you need is a checkerboard or something.

Spawning a SpriteGridBundle is similar to spawning an ordinary Bevy SpriteBundle. Transformations applied to the SpriteGrid entity should correctly propagate to its sprites.

No proper documentation, but there are quite a lot of examples in the /examples dir.

Performance should be fine, and more than enough for most practical purposes. It's not optimised at all though, except for culling of off screen grid cells. It shouldn't matter how many cells a SpriteGrid has (even tens of millions), as long as most of them are out of view.

The math is a bit of a mess and probably includes a few unnecessary operations. The SpriteGrid API is a work in progress as well.

If you are doing a tile based 2D game you almost certainly want to use bevy_ecs_tilemap instead, which is well supported, has great performance, and lots of features.

Version 0.5

Updated to support Bevy 0.8. API unchanged except that SpriteGrid entities now require a ComputedVisibility component or they won't be displayed.

Version 0.4

Updated to support Bevy 0.7

Dependencies

~37–51MB
~720K SLoC