Struct Asset
Defined in File sprite.h
Inheritance Relationships
Base Type
public CE::Assets::Content2D(Struct Content2D)
Struct Documentation
-
struct Asset : public CE::Assets::Content2D
Declaration:
finalRetains a definition snapshot and grid resources.
Construction checks nonempty cells/clips, frame cells/durations and duplicate clip keys, not all manifest fields or backend compatibility. Read concurrently only while inputs are stable.
Public Functions
-
explicit Asset(Data data)
Retain resources and own an immutable sprite definition snapshot.
See also
- Parameters:
data – Resource/metadata transfer bundle; backend compatibility is the caller’s contract. Checks nonempty cell count, nonempty clips, positive durations, frame-cell bounds and duplicate name/facing keys. Invalid clip data rejects; it does not revalidate every manifest field or create default materials.
-
Animation operator[](const std::string &animation) const
Create an independent cursor using faceless animation lookup.
See also
- Parameters:
animation – Exact clip name.
- Returns:
CPU-only playback cursor; same missing/ambiguous errors as animation().
-
Animation animation(const std::string &animation, std::optional<std::string> facing = std::nullopt) const
Create independent playback retaining the matching CPU clip snapshot.
See also
- Parameters:
animation – Exact clip name.
facing – Optional exact facing; when absent, an exact unqualified clip wins, otherwise one uniquely named facing clip is accepted.
- Throws:
CE::Exceptions::bad_request – For missing or ambiguous selection. Stable asset reads may be concurrent; mutate returned cursors on their own owners.
- Returns:
Cursor initially at its first frame, independent of other entities.
-
bool has_animation(const std::string &animation, std::optional<std::string> facing = std::nullopt) const
Declaration:
[[nodiscard]]Check whether animation() has an exact or uniquely resolvable clip.
See also
- Returns:
False for missing or ambiguous faceless queries; does not construct a cursor.
-
const CE::Assets::Grids::View &view(const std::string &name) const
Declaration:
[[nodiscard]]Borrow a named view for this asset’s lifetime.
See also
- Parameters:
name – Exact metadata key; unknown names throw std::out_of_range. No geometry or cell selection is changed.
-
CE::Assets::Grids::CellIndex orientation(const std::string &name) const
Declaration:
[[nodiscard]]Copy a named static cell ordinal.
See also
- Parameters:
name – Exact metadata key; unknown names throw std::out_of_range. No animation clock or rendering mutation occurs.
-
inline const Definition &definition() const
Declaration:
[[nodiscard]]Borrow this asset’s immutable metadata snapshot; reference lifetime follows this asset.
See also
-
explicit Asset(Data data)