Skip to main content

Tilemap

Struct Tilemap 

Source
pub struct Tilemap {
    pub events: Ledger<TilemapEvent>,
    /* private fields */
}

Fields§

§events: Ledger<TilemapEvent>

Implementations§

Source§

impl Tilemap

Source

pub fn world_to_tile_pos(&self, world_pos: &Vec2) -> V2i32

Source

pub fn tile_to_world_pos(&self, tile_pos: &V2i32) -> Vec2

Source

pub fn quantize(&self, t: &Box2d, world_pos: &Vec2) -> Rect2i32

Source

pub fn tile_to_chunk_and_local_pos(&self, tile_pos: &V2i32) -> (V2i32, V2i32)

Source

pub fn tile_to_chunk_pos(&self, tile_pos: &V2i32) -> V2i32

Source

pub fn get_chunk(&self, chunk_pos: &V2i32) -> Option<&Chunk>

Source

pub fn get_tile(&self, pos: V2i32) -> u8

Source

pub fn set_tile(&mut self, pos: V2i32, tile: u8)

Source

pub fn remove_tile(&mut self, pos: V2i32)

Source

pub fn simple_resolve_ball(&self, col: &Ball, pos: Vec2, dir: &Vec2) -> Vec2

Source

pub fn simple_resolve_box(&self, col: &Box2d, pos: Vec2, dir: &Vec2) -> Vec2

Source§

impl Tilemap

Source

pub fn save(&self, filename: &'static str) -> Result<()>

Source

pub fn load(filename: &'static str) -> Result<Self>

Trait Implementations§

Source§

impl CollidesRel2d<Point> for Tilemap

Source§

fn collides_rel(&self, _t: &Point, rel: &impl Transformation2d) -> bool

Checks whether objects collide. Read more
Source§

impl Default for Tilemap

Source§

fn default() -> Tilemap

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Tilemap

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PenetratesRel2d<Point> for Tilemap

Source§

fn penetrates_rel( &self, _t: &Point, rel: &impl Transformation2d, ) -> Option<Vec2>

Computes the smallest penetration vector between self and t. Read more
Source§

impl Serialize for Tilemap

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<A, B, T> Collides2d<B, T> for A

Source§

fn collides(&self, transform: &T, t: &B, t_transform: &T) -> bool

Checks whether objects collide. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<A, B, T> Penetrates2d<B, T> for A

Source§

fn penetrates(&self, a_transform: &T, b: &B, b_transform: &T) -> Option<Vec2>

Computes the smallest penetration vector between self and t. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.