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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
use bevy::{
ecs::bundle::Bundle,
render::view::{InheritedVisibility, ViewVisibility, Visibility},
transform::components::{GlobalTransform, Transform},
};
use super::map::{
TilePivot, TileRenderSize, TilemapAnimations, TilemapLayerOpacities, TilemapName,
TilemapSlotSize, TilemapStorage, TilemapTexture, TilemapTransform, TilemapType,
};
/// The bundle of the tilemap with no actual tiles.
#[derive(Bundle, Default, Debug, Clone)]
pub struct DataTilemapBundle {
/// The name of the tilemap. This can be used in saving the tilemap.
pub name: TilemapName,
/// The render size of tiles in pixels.
pub tile_render_size: TileRenderSize,
/// The size of each slot in pixels. This can be different from the render size.
/// And you can create margins and paddings.
pub slot_size: TilemapSlotSize,
/// The type of the tilemap.
pub ty: TilemapType,
/// The pivot of the tiles.
pub tile_pivot: TilePivot,
/// The transform of the tilemap. It's not the same one as `Transform`.
/// If you want to move or rotate the tilemap, you need to change this.
/// Modify the `Transform` component will not work.
pub tilemap_transform: TilemapTransform,
}
/// The bundle of the tilemap with a texture.
#[derive(Bundle, Default, Debug, Clone)]
pub struct TilemapBundle {
/// The name of the tilemap. This can be used in saving the tilemap.
pub name: TilemapName,
/// The render size of tiles in pixels.
pub tile_render_size: TileRenderSize,
/// The size of each slot in pixels. This can be different from the render size.
/// And you can create margins and paddings.
pub slot_size: TilemapSlotSize,
/// The type of the tilemap.
pub ty: TilemapType,
/// The pivot of the tiles.
pub tile_pivot: TilePivot,
/// The opacities of each **rendered** layer.
///
/// Only the top 4 layers will be rendered.
pub layer_opacities: TilemapLayerOpacities,
/// The storage of the tilemap. The entities of each tiles are divided into chunks and stored in it.
///
/// You need to spawn an empty tilemap and assign it to the storage.
pub storage: TilemapStorage,
/// The transform of the tilemap. It's not the same one as `Transform`.
/// If you want to move or rotate the tilemap, you need to change this.
/// Modify the `Transform` component will not work.
pub tilemap_transform: TilemapTransform,
/// The texture of the tilemap.
pub texture: TilemapTexture,
/// All the animation sequences of the tilemap.
pub animations: TilemapAnimations,
/// Just to make sure the child sprites are correctly rendered.
pub visibility: Visibility,
/// Just to make sure the child sprites are correctly rendered.
pub inherited_visibility: InheritedVisibility,
/// Just to make sure the child sprites are correctly rendered.
pub view_visibility: ViewVisibility,
/// Modify `TilemapTransform` instead of this one.
pub transform: Transform,
/// Just to make sure the child sprites are correctly rendered.
pub global_transform: GlobalTransform,
}
/// The bundle of the tilemap without a texture. This can be cheaper.
#[derive(Bundle, Default, Debug, Clone)]
pub struct PureColorTilemapBundle {
/// The name of the tilemap. This can be used in saving the tilemap.
pub name: TilemapName,
/// The render size of tiles in pixels.
pub tile_render_size: TileRenderSize,
/// The size of each slot in pixels. This can be different from the render size.
/// And you can create margins and paddings.
pub slot_size: TilemapSlotSize,
/// The type of the tilemap.
pub ty: TilemapType,
/// The pivot of the tiles.
pub tile_pivot: TilePivot,
/// The opacities of each **rendered** layer.
///
/// Only the top 4 layers will be rendered.
pub layer_opacities: TilemapLayerOpacities,
/// The storage of the tilemap. The entities of each tiles are divided into chunks and stored in it.
///
/// You need to spawn an empty tilemap and assign it to the storage.
pub storage: TilemapStorage,
/// The transform of the tilemap. It's not the same one as `Transform`.
/// If you want to move or rotate the tilemap, you need to change this.
/// Modify the `Transform` component will not work.
pub tilemap_transform: TilemapTransform,
/// Just to make sure the child sprites are correctly rendered.
pub visibility: Visibility,
/// Just to make sure the child sprites are correctly rendered.
pub inherited_visibility: InheritedVisibility,
/// Just to make sure the child sprites are correctly rendered.
pub view_visibility: ViewVisibility,
/// Modify `TilemapTransform` instead of this one.
pub transform: Transform,
/// Just to make sure the child sprites are correctly rendered.
pub global_transform: GlobalTransform,
}