Crates.io | bevy_simple_tilemap |
lib.rs | bevy_simple_tilemap |
version | |
source | src |
created_at | 2021-05-22 12:24:32.111466 |
updated_at | 2024-11-30 11:20:50.913299 |
description | Refreshingly simple tilemap implementation for Bevy Engine. |
homepage | |
repository | https://github.com/forbjok/bevy_simple_tilemap.git |
max_upload_size | |
id | 400802 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Refreshingly simple tilemap implementation for Bevy Engine.
The main reason I started this was because I felt the existing tilemap implementations for Bevy were needlessly complicated to use when all you want to do is to as quickly and simply as possible render a grid of tiles to the screen, often exposing internal implementation details such as chunks to the user.
fn setup(
asset_server: Res<AssetServer>,
mut commands: Commands,
mut texture_atlases: ResMut<Assets<TextureAtlas>>,
) {
// Load tilesheet texture and make a texture atlas from it
let image = asset_server.load("textures/tilesheet.png");
let atlas = TextureAtlasLayout::from_grid(uvec2(16, 16), 4, 1, Some(uvec2(1, 1)), None);
let atlas_handle = texture_atlases.add(atlas);
// Spawn tilemap
commands.spawn(TileMap::new(image, atlas_handle));
}
tilemap.set_tile(ivec3(0, 0, 0), Some(Tile { sprite_index: 0, color: Color::WHITE }));
// List to store set tile operations
let mut tiles: Vec<(IVec3, Option<Tile>)> = Vec::new();
tiles.push((ivec3(0, 0, 0), Some(Tile { sprite_index: 0, color: Color::WHITE })));
tiles.push((ivec3(1, 0, 0), Some(Tile { sprite_index: 1, color: Color::WHITE })));
// Perform tile update
tilemap.set_tiles(tiles);