Skip to content

Commit

Permalink
Removing obsolete example documentation. Need to replace them with up…
Browse files Browse the repository at this point in the history
…dated versions later.
  • Loading branch information
b-guild committed Dec 24, 2024
1 parent 307b6fc commit 486881a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 94 deletions.
74 changes: 0 additions & 74 deletions fyrox-impl/src/scene/tilemap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,80 +786,6 @@ impl OrthoTransform for TileRenderData {

/// Tile map is a 2D "image", made out of a small blocks called tiles. Tile maps used in 2D games to
/// build game worlds quickly and easily.
///
/// ## Example
///
/// The following example creates a simple tile map with two tile types - grass and stone. It creates
/// stone foundation and lays grass on top of it.
///
/// ```rust
/// use fyrox_impl::{
/// asset::untyped::ResourceKind,
/// core::{algebra::Vector2, color::Color, math::Rect, pool::Handle},
/// material::{Material, MaterialResource},
/// scene::{
/// base::BaseBuilder,
/// graph::Graph,
/// node::Node,
/// tilemap::{
/// tileset::{TileCollider, TileDefinition, TileSet, TileSetResource},
/// Tile, TileMapBuilder, Tiles,
/// },
/// },
/// };
///
/// fn create_tile_map(graph: &mut Graph) -> Handle<Node> {
/// // Each tile could have its own material, for simplicity it is just a standard 2D material.
/// let material = MaterialResource::new_ok(ResourceKind::Embedded, Material::standard_2d());
///
/// // Create a tile set - it is a data source for the tile map. Tile map will reference the tiles
/// // stored in the tile set by handles. We'll create two tile types with different colors.
/// let mut tile_set = TileSet::default();
/// let stone_tile = tile_set.add_tile(TileDefinition {
/// material: material.clone(),
/// uv_rect: Rect::new(0.0, 0.0, 1.0, 1.0),
/// collider: TileCollider::Rectangle,
/// color: Color::BROWN,
/// position: Default::default(),
/// properties: vec![],
/// });
/// let grass_tile = tile_set.add_tile(TileDefinition {
/// material,
/// uv_rect: Rect::new(0.0, 0.0, 1.0, 1.0),
/// collider: TileCollider::Rectangle,
/// color: Color::GREEN,
/// position: Default::default(),
/// properties: vec![],
/// });
/// let tile_set = TileSetResource::new_ok(ResourceKind::Embedded, tile_set);
///
/// let mut tiles = Tiles::default();
///
/// // Create stone foundation.
/// for x in 0..10 {
/// for y in 0..2 {
/// tiles.insert(Tile {
/// position: Vector2::new(x, y),
/// definition_handle: stone_tile,
/// });
/// }
/// }
///
/// // Add grass on top of it.
/// for x in 0..10 {
/// tiles.insert(Tile {
/// position: Vector2::new(x, 2),
/// definition_handle: grass_tile,
/// });
/// }
///
/// // Finally create the tile map.
/// TileMapBuilder::new(BaseBuilder::new())
/// .with_tile_set(tile_set)
/// .with_tiles(tiles)
/// .build(graph)
/// }
/// ```
#[derive(Clone, Reflect, Debug, Visit, ComponentProvider, TypeUuidProvider)]
#[type_uuid(id = "aa9a3385-a4af-4faf-a69a-8d3af1a3aa67")]
pub struct TileMap {
Expand Down
20 changes: 0 additions & 20 deletions fyrox-impl/src/scene/tilemap/tile_rect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,26 +176,6 @@ impl OptionTileRect {
}

/// Extends the rectangle so it will contain the other rectangle.
///
/// # Notes
///
/// To build a bounding rectangle, initialize an OptionRect to default.
///
/// ```
/// # use nalgebra::Vector2;
/// # use rectutils::Rect;
///
/// let vertices = [Vector2::new(1, 2), Vector2::new(-3, 5)];
///
/// let mut bounding_rect = OptionTileRect::default();
///
/// for &v in &vertices {
/// bounding_rect.push(v);
/// }
///
/// // So long as vertices is not empty, bounding_rect is guaranteed to be some.
/// let bounding_rect = bounding_rect.unwrap();
/// ```
#[inline]
pub fn extend_to_contain(&mut self, other: TileRect) {
if let Some(rect) = &mut self.0 {
Expand Down

0 comments on commit 486881a

Please sign in to comment.