Renderer

Struct Renderer 

Source
pub struct Renderer<B, M>{ /* private fields */ }

Implementations§

Source§

impl<B, M> Renderer<B, M>

Source

pub fn set_update_interval(&mut self, amount: usize)

set how aggrisive draw batches should try to merge

Source

pub fn get_terminal_size(&self) -> (u16, u16)

Source

pub fn create_renderer(size: (u16, u16)) -> Self

Create a new renderer with an initial terminal size.

Source

pub fn create_screen(&mut self, rect: AreaRect, layer: usize) -> ScreenKey

Create a new screen and return its key.

Source

pub fn change_screen_area( &mut self, screen_id: ScreenKey, new_area: AreaRect, ) -> Result<(), DrawError>

Source

pub fn fit_screen_area_to_contents( &mut self, screen_id: ScreenKey, ) -> Result<(), DrawError>

Source

pub fn add_on_screen_select( &mut self, screen_id: ScreenKey, callback: Box<dyn FnMut() + Send + 'static>, )

Source

pub fn change_screen_layer( &mut self, screen_id: ScreenKey, new_layer: usize, ) -> Result<(), DrawError>

Source

pub fn register_drawable( &mut self, screen_id: ScreenKey, obj: DrawObject, ) -> Result<DrawObjectKey, DrawError>

Register a drawable object on a screen.

Source

pub fn remove_drawable(&mut self, id: DrawObjectKey) -> Result<(), DrawError>

Source

pub fn explicit_remove_drawable( &mut self, id: &DrawObjectKey, ) -> Result<(), DrawError>

Source

pub fn replace_drawable( &mut self, id: DrawObjectKey, drawable: Box<dyn Drawable>, ) -> Result<(), DrawError>

Source

pub fn check_if_object_lifetime_ended(&mut self) -> Result<(), DrawError>

checks if any of the currently existing drawobjects should be removed, because its duration on screen has ended

Source

pub fn register_sprite_from_source( &mut self, path: &str, ) -> Result<SpriteId, AppError>

Load a sprite from an ASCII video file.

Source

pub fn render_screen(&mut self, screen_id: ScreenKey) -> Result<(), AppError>

Source

pub fn render_drawable( &mut self, object_key: DrawObjectKey, ) -> Result<(), DrawError>

Render a single drawable object.

Source

pub fn handle_resize(&mut self, new_size: (u16, u16)) -> Result<(), DrawError>

Source

pub fn generate_screen_key(&self) -> ScreenKey

Generate a unique screen key.

Source

pub fn move_drawable_to( &mut self, handle: DrawObjectKey, new_pos: Point<i32>, ) -> Result<(), DrawError>

Source

pub fn move_drawable_by( &mut self, handle: DrawObjectKey, dx: i32, dy: i32, ) -> Result<(), DrawError>

Source

pub fn move_drawable_point( &mut self, handle: DrawObjectKey, point_index: usize, new_pos: Point<i32>, ) -> Result<(), DrawError>

Source

pub fn move_multipoint_drawable_point( &mut self, handle: DrawObjectKey, point_index: usize, new_pos: Point<i32>, ) -> Result<(), DrawError>

Source

pub fn replace_drawable_points( &mut self, handle: DrawObjectKey, new_points: Vec<Point<i32>>, ) -> Result<(), DrawError>

replace a drawables points

Source

pub fn run_drawable_screen_fitting( &mut self, handle: DrawObjectKey, unadjusted_screen_area: Rect<i32>, ) -> Result<(), DrawError>

Source

pub fn get_amount_of_points( &mut self, handle: DrawObjectKey, ) -> Result<Option<usize>, DrawError>

Source

pub fn handle_screen_selection( &mut self, hook: &EventHook, ) -> Result<(), AppError>

selects a different screen, if a mouse button has been clicked the EventHook is needed to access the mouse’s current position

Source

pub fn add_screen_select_handler( &mut self, screen_select_handler: ScreenSelectHandler, )

Source

pub fn into_buffered(self) -> Renderer<B, M>

Source

pub fn into_instant(self) -> Renderer<B, M>

Source§

impl<B, Buffered> Renderer<B, Buffered>

Source

pub fn render_frame(&mut self) -> Result<(), DrawError>

Source

pub fn remove_all_framebased_objects(&mut self) -> Result<(), DrawError>

removes all the objects from screen, that have frame-based removal

Auto Trait Implementations§

§

impl<B, M> Freeze for Renderer<B, M>
where B: Freeze,

§

impl<B, M> !RefUnwindSafe for Renderer<B, M>

§

impl<B, M> Send for Renderer<B, M>
where B: Send, M: Send,

§

impl<B, M> !Sync for Renderer<B, M>

§

impl<B, M> Unpin for Renderer<B, M>
where B: Unpin, M: Unpin,

§

impl<B, M> !UnwindSafe for Renderer<B, M>

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<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<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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V