Module resources

Source
Expand description

The resource database and everything related to querying, loading, and using assets from it.

Modules§

audio_clip
Asset type for individual tracks of audio.
sprite
Asset type for individual images that can be rendered as-is.

Structs§

ChunkData
Loaded memory for a single regular chunk. Contains CHUNK_SIZE bytes.
ChunkDescriptor
Metadata for loading in a ChunkData.
FileReader
File reading utility.
NamedAsset
A unique name and a T. Used in ResourceDatabase and when creating the db file.
ResourceDatabase
The resource database.
ResourceDatabaseHeader
Basic info about a ResourceDatabase used in its initialization and for de/serializing the db file.
ResourceLoader
Asynchronous loader for resource chunks.
SpriteChunkData
Loaded (video) memory for a single sprite chunk. Contains a reference to a loaded sprite, ready for drawing, with the size and format SPRITE_CHUNK_DIMENSIONS and SPRITE_CHUNK_FORMAT.
SpriteChunkDescriptor
Metadata for loading in a SpriteChunkData.

Constants§

ASSET_NAME_LENGTH
Maximum length for the unique names of assets.
AUDIO_SAMPLES_PER_CHUNK
The amount of audio samples that fit in each chunk.
CHUNK_SIZE
Amount of bytes in the regular dynamically allocated chunks.
RESOURCE_DB_MAGIC_NUMBER
Magic number used when de/serializing ResourceDatabaseHeader.
SPRITE_CHUNK_DIMENSIONS
Width and height of the dynamically allocated sprite chunks.
SPRITE_CHUNK_FORMAT
Pixel format of the dynamically allocated sprite chunks.

Traits§

Asset
Trait for operations relevant to any assets, for writing asset management code which is generic over the particular asset type.
Deserialize
Trait for describing how a type can be parsed from a constant-size byte slice.
Serialize
Trait for describing how a type can be serialized into a constant-size byte slice.

Functions§

deserialize
Deserializes the data from a byte slice into D, reading from the given cursor, and advancing it by the amount of bytes read.
serialize
Serializes the data into a byte slice, with the write starting from the cursor, and advances the cursor by the amount of bytes written.