Module utils

Source
Expand description

Utility functions used internally by the plugin that have been exposed to the public api.

Functions§

calculate_transform_from_entity_instance
Performs EntityInstance to Transform conversion
create_entity_definition_map
Simple conversion from a list of EntityDefinitions to a map using their Uids as the keys.
create_layer_definition_map
Simple conversion from a list of LayerDefinitions to a map using their Uids as the keys.
grid_coords_to_ldtk_grid_coords
Performs GridCoords to LDtk grid coordinate conversion.
grid_coords_to_translation
Performs GridCoords to translation conversion, so that the resulting translation is in the the center of the tile.
grid_coords_to_translation_relative_to_tile_layer
Performs GridCoords to translation conversion (relative to the layer), so that the resulting translation is in the the center of the tile.
int_grid_index_to_grid_coords
The int_grid_csv field of a LayerInstance is a 1-dimensional Vec<i32>. This function can map the indices of this Vec to a corresponding GridCoords.
ldtk_grid_coords_to_grid_coords
Performs LDtk grid coordinate to GridCoords conversion.
ldtk_grid_coords_to_translation
Performs LDtk grid coordinate to translation conversion, so that the resulting translation is in the center of the tile.
ldtk_grid_coords_to_translation_relative_to_tile_layer
Performs LDtk grid coordinate to translation conversion, so that the resulting translation is in the center of the tile.
ldtk_pixel_coords_to_grid_coords
Performs LDtk pixel coordinate to GridCoords conversion.
ldtk_pixel_coords_to_translation
Performs LDtk pixel coordinate to translation conversion.
ldtk_pixel_coords_to_translation_pivoted
Performs LDtk pixel coordinate to translation conversion, with “pivot” support.
sprite_from_entity_info
Creates a Sprite from the entity information available to the LdtkEntity::bundle_entity method.
sprite_sheet_from_entity_info
Creates a Sprite with TextureAtlas from the entity information available to the LdtkEntity::bundle_entity method.
translation_to_grid_coords
Performs translation to GridCoords conversion.
translation_to_ldtk_pixel_coords
Performs translation to LDtk pixel coordinate conversion.