ScreenBuffer

pub trait ScreenBuffer: ScreenBufferCore {
    type Drawer: CellDrawer + Send + 'static;

    // Required methods
    fn new(size: (u16, u16)) -> Self
       where Self: Sized;
    fn drawer_sender(&self) -> SyncSender<CellDrawerCommand>;
    fn drop(&mut self);

    // Provided methods
    fn add_to_buffer(
        &mut self,
        obj: &mut DrawObject,
        obj_id: ObjectId,
        screen_layer: usize,
        bounds: &Rect<i32>,
        sprites: &SpriteRegistry,
    ) -> Result<(), DrawError> { ... }
    fn remove_from_buffer(
        &mut self,
        obj: &DrawObject,
        obj_id: ObjectId,
        sprites: &SpriteRegistry,
        bounds: &Rect<i32>,
    ) { ... }
    fn update_terminal(&mut self, expand: usize) -> Result<(), DrawError> { ... }
    fn mark_all_dirty(&mut self, new_size: (u16, u16)) { ... }
    fn idx_of(&self, pos: Point<i32>) -> usize { ... }
    fn handle_none_interval_creator(
        &mut self,
        opt_c: Option<UpdateIntervalCreator>,
        shift_amount: Point<i32>,
    ) -> HashMap<u16, Vec<UpdateInterval>> { ... }
}
Expand description

Public API that combines the core bookkeeping with the drawing layer

Required Associated Types§

Source

type Drawer: CellDrawer + Send + 'static

Required Methods§

Source

fn new(size: (u16, u16)) -> Self
where Self: Sized,

Source

fn drawer_sender(&self) -> SyncSender<CellDrawerCommand>

Source

fn drop(&mut self)

Provided Methods§

Source

fn add_to_buffer( &mut self, obj: &mut DrawObject, obj_id: ObjectId, screen_layer: usize, bounds: &Rect<i32>, sprites: &SpriteRegistry, ) -> Result<(), DrawError>

Add an object to the buffer.

Source

fn remove_from_buffer( &mut self, obj: &DrawObject, obj_id: ObjectId, sprites: &SpriteRegistry, bounds: &Rect<i32>, )

Remove an object from the buffer.

Source

fn update_terminal(&mut self, expand: usize) -> Result<(), DrawError>

Source

fn mark_all_dirty(&mut self, new_size: (u16, u16))

Source

fn idx_of(&self, pos: Point<i32>) -> usize

Source

fn handle_none_interval_creator( &mut self, opt_c: Option<UpdateIntervalCreator>, shift_amount: Point<i32>, ) -> HashMap<u16, Vec<UpdateInterval>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<CD> ScreenBuffer for DefaultScreenBuffer<CD>
where CD: CellDrawer + Send + 'static,

Source§

type Drawer = CD