forked from StarArawn/bevy_ecs_tilemap
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtiled.rs
41 lines (36 loc) · 1.18 KB
/
tiled.rs
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
use bevy::prelude::*;
use bevy_ecs_tilemap::prelude::*;
mod helpers;
fn startup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2dBundle::default());
let map_handle: Handle<helpers::tiled::TiledMap> = asset_server.load("map.tmx");
commands.spawn(helpers::tiled::TiledMapBundle {
tiled_map: map_handle,
..Default::default()
});
}
fn main() {
App::new()
.add_plugins(
DefaultPlugins
.set(WindowPlugin {
window: WindowDescriptor {
width: 1270.0,
height: 720.0,
title: String::from("Tiled Map Editor Example"),
..Default::default()
},
..default()
})
.set(ImagePlugin::default_nearest())
.set(AssetPlugin {
watch_for_changes: true,
..default()
}),
)
.add_plugin(TilemapPlugin)
.add_plugin(helpers::tiled::TiledMapPlugin)
.add_startup_system(startup)
.add_system(helpers::camera::movement)
.run();
}