Crate tego

Source
Expand description

tego is a simple library for loading Tiled maps.

It aims to provide a simple, yet flexible API, without forcing any special image format to the user or assuming that data is provided as a file.

As a starting point, load a map using any of the from_* functions provided in the Map type. And inspect the Layers inside of it.

let path = std::path::Path::new("example-maps/default/default_map.tmx");
let mymap = tego::Map::from_file(&path)?;

println!(
    "Map {} is {} by {} pixels.", path.display(),
    mymap.size.x * mymap.tile_size.x, mymap.size.y * mymap.tile_size.y
);

Modules§

  • Module to contain some simple math primitives for working with pixel coordinates.

Structs§

  • An 8 bit RGB color with alpha value.
  • Provider that reads the data from files on the file system.
  • Global Tile ID A GID acts as an index into any tileset referenced in the map
  • A layer to group multiple sub-layers
  • The Map struct is the top level container for all relevant data inside of a Tiled map. A Map consists of TileSets and Layers. Stacking the layers in iteration order creates the final map image. Each layer contains indices (GIDs) referencing a specific tile in a tile sets.
  • An element of an ObjectLayer. Objects do not need to be aligned to the normal tile grid. Objects can have different kinds, (e.g. rect, ellipse, text). See ObjectKind for more info.
  • An ObjectLayer is a container of Objects. Objects are not aligned to the tile grid, and can be used to include extra information in a map.
  • Version number consisting out of a MAJOR and MINOR version number, followed by an optional PATCH

Enums§

Traits§

Type Aliases§