fn render_tile(
        &self,
        buf: &mut String,
        colors: &mut Color2,
        cursor: &mut Vec2,
        screen_size: Vec2,
        coord: Vec2,
    ) -> Result<(), Error> {
        if *cursor != coord {
            write!(
                buf,
                "{}",
                crossterm::cursor::MoveTo(
                    coord::to_crossterm(coord.x),
                    coord::to_crossterm(coord.y)
                )
            )?;
        }
        *cursor = coord;

        let tile = self.get(*cursor);
        if colors.background != tile.colors.background {
            let color = tile.colors.background.to_crossterm();
            write!(buf, "{}", crossterm::style::SetBackgroundColor(color))?;
        }
        if colors.foreground != tile.colors.foreground {
            let color = tile.colors.foreground.to_crossterm();
            write!(buf, "{}", crossterm::style::SetForegroundColor(color))?;
        }
        *colors = tile.colors;

        write!(buf, "{}", tile.grapheme)?;

        if cursor.x <= screen_size.x {
            cursor.x += 1;
        }

        Ok(())
    }
/// Renders a single tile in the given coordinate.
Renders a single tile in the given coordinate.
Renders a single tile in the given coordinate .
fn render_tile(
        &self,
        buf: &mut String,
        colors: &mut Color2,
        cursor: &mut Vec2,
        screen_size: Vec2,
        coord: Vec2,
    ) -> Result<(), Error> {
        if *cursor != coord {
            write!(
                buf,
                "{}",
                crossterm::cursor::MoveTo(
                    coord::to_crossterm(coord.x),
                    coord::to_crossterm(coord.y)
                )
            )?;
        }
        *cursor = coord;
        let tile = self.get(*cursor);
        if colors.background != tile.colors.background {
            let color = tile.colors.background.to_crossterm();
            write!(buf, "{}", crossterm::style::SetBackgroundColor(color))?;
        }
        if colors.foreground != tile.colors.foreground {
            let color = tile.colors.foreground.to_crossterm();
            write!(buf, "{}", crossterm::style::SetForegroundColor(color))?;
        }
        *colors = tile.colors;
        write!(buf, "{}", tile.grapheme)?;
        if cursor.x <= screen_size.x {
            cursor.x += 1;
        }
        Ok(())
    }
fn render_tile ( & self , buf : & mut String , colors : & mut Color2 , cursor : & mut Vec2 , screen_size : Vec2 , coord : Vec2 , ) -> Result < ( ) , Error > { if * cursor != coord { write ! ( buf " " crossterm cursor MoveTo ( coord to_crossterm ( coord x ) coord to_crossterm ( coord y ) ) ) ? ; } * cursor = coord ; let tile = self . get ( * cursor ) ; if colors . background != tile . colors . background { let color = tile . colors . background . to_crossterm ( ) ; write ! ( buf " " crossterm style SetBackgroundColor ( color ) ) ? ; } if colors . foreground != tile . colors . foreground { let color = tile . colors . foreground . to_crossterm ( ) ; write ! ( buf " " crossterm style SetForegroundColor ( color ) ) ? ; } * colors = tile . colors ; write ! ( buf " " tile grapheme ) ? ; if cursor . x <= screen_size . x { cursor . x += 1 ; } Ok ( ( ) ) }
Renders a single tile in the given coordinate.
Renders a single tile in the given coordinate .
&self
buf
&mut String
colors
&mut Color2
cursor
&mut Vec2
screen_size
Vec2
coord
Vec2
&self
buf
&mut String
colors
&mut Color2
cursor
&mut Vec2
screen_size
Vec2
coord
Vec2