forked from StarArawn/bevy_ecs_tilemap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtiled.rs
More file actions
44 lines (37 loc) · 1.2 KB
/
tiled.rs
File metadata and controls
44 lines (37 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use bevy::prelude::*;
use bevy_ecs_tilemap::prelude::*;
mod helpers;
fn startup(
mut commands: Commands,
asset_server: Res<AssetServer>,
) {
commands.spawn_bundle(OrthographicCameraBundle::new_2d());
let handle: Handle<TiledMap> = asset_server.load("map.tmx");
let map_entity = commands.spawn().id();
commands.entity(map_entity)
.insert_bundle(TiledMapBundle {
tiled_map: handle,
map: Map::new(0u16, map_entity),
transform: Transform::from_xyz(0.0, 0.0, 0.0),
..Default::default()
});
}
fn main() {
env_logger::Builder::from_default_env()
.filter_level(log::LevelFilter::Info)
.init();
App::build()
.insert_resource(WindowDescriptor {
width: 1270.0,
height: 720.0,
title: String::from("Tiled map editor example"),
..Default::default()
})
.add_plugins(DefaultPlugins)
.add_plugin(TilemapPlugin)
.add_plugin(TiledMapPlugin)
.add_startup_system(startup.system())
.add_system(helpers::camera::movement.system())
.add_system(helpers::texture::set_texture_filters_to_nearest.system())
.run();
}