Trouv / bevy_ecs_ldtk

ECS-friendly ldtk plugin for bevy, leveraging bevy_ecs_tilemap
Other
641 stars 73 forks source link

feat: add LoadedLevel type that wraps around levels with complete data #214

Closed Trouv closed 11 months ago

Trouv commented 11 months ago

Works towards #205.

In order to better handle internal/external level storage, it will be helpful to a have a type that represents "complete" level data. For projects with internal levels, the normal levels embedded on the LdtkProject are "complete". For external level projects, the levels on the main project file are incomplete, and the complete data is stored separately.

This provides a type for representing complete level data. It does so by wrapping around Level by reference, and enforces the loadedness of the borrowed level on construction. It also provides immutable getters for all the level's fields, and .expects() away the fields that will not be null since the level is loaded (layer_instances).