pub trait AtlasAllocator {
    type Config;

    // Required methods
    fn with_max_size(max_size: Vec2<u16>, config: Self::Config) -> Self;
    fn allocate(&mut self, size: Vec2<u16>) -> Option<Rectangle>;
    fn size(&self) -> Vec2<u16>;
    fn grow(&mut self, new_size: Vec2<u16>);
}
Expand description

Abstraction over different atlas allocators. Useful to swap out the allocator implementation for specific cases (e.g. sprites).

Required Associated Types§

Required Methods§

source

fn with_max_size(max_size: Vec2<u16>, config: Self::Config) -> Self

Creates a new instance of this atlas allocator taking into account the provided max size;

source

fn allocate(&mut self, size: Vec2<u16>) -> Option<Rectangle>

Allocates a rectangle of the given size.

source

fn size(&self) -> Vec2<u16>

Retrieves the current size of the atlas being allocated from.

source

fn grow(&mut self, new_size: Vec2<u16>)

Grows the size of the atlas to the provided size.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl AtlasAllocator for SimpleAtlasAllocator

source§

fn allocate(&mut self, size: Vec2<u16>) -> Option<Rectangle>

Allocates a rectangle of the given size.

source§

fn size(&self) -> Vec2<u16>

Retrieves the current size of the atlas being allocated from.

source§

fn grow(&mut self, new_size: Vec2<u16>)

Grows the size of the atlas to the provided size.

§

type Config = AllocatorOptions

source§

fn with_max_size(max_size: Vec2<u16>, config: Self::Config) -> Self

Implementors§

source§

impl AtlasAllocator for GuillotiereTiled

§

type Config = AllocatorOptions