Struct termbox::Termbox
[−]
[src]
pub struct Termbox { /* fields omitted */ }
The main entry point for all termbox functions.
This ensures that the terminal can only be accessed from one thread.
Sadly, writing to stdout
can potentially interfere with termbox output.
Methods
impl Termbox
[src]
fn blit(&mut self, x: Coord, y: Coord, w: Coord, h: Coord, cells: &[Cell])
Copies a rectangular region of cells from a slice to the output buffer.
fn cell_buffer<'a>(&'a self) -> &'a [Cell]
Returns a slice representing the output buffer.
fn cell_buffer_mut<'a>(&'a mut self) -> &'a mut [Cell]
Returns a mutable slice representing the output buffer.
fn change_cell(
&mut self,
x: Coord,
y: Coord,
ch: char,
fg: Attribute,
bg: Attribute
)
&mut self,
x: Coord,
y: Coord,
ch: char,
fg: Attribute,
bg: Attribute
)
Changes a single cell in the output buffer.
fn clear(&mut self)
Clears the output buffer and sets all cell attributes to those specified with
set_clear_attributes
.
fn height(&self) -> Coord
Returns the height of the output buffer in character cells.
fn hide_cursor(&mut self)
Sets the cursor to an invalid position, making it invisible to the user.
fn input_mode(&self) -> InputMode
Returns the input mode. See set_input_mode
.
fn is_mouse_enabled(&self) -> bool
Determines whether mouse events are enabled. See set_mouse_enabled
.
fn open() -> Result<Termbox>
Locks the terminal to an instance of Termbox
. Only one instance may exist in a process.
fn output_mode(&self) -> OutputMode
Returns the current output mode. See set_output_mode
.
fn peek_event(&mut self, timeout: Time) -> Option<Event>
Waits up to timeout
milliseconds for an event. If an event is received, that event is
returned. Otherwise, None
is returned. A timeout
of zero can be specified to poll for
events that have already been received without waiting.
fn poll_event(&mut self) -> Event
Waits for an input event and returns it.
fn present(&mut self)
Writes any changes to the output buffer into the terminal. This must be called in order for the user to see any changes.
fn put_cell(&mut self, x: Coord, y: Coord, cell: Cell)
Changes a single character cell.
fn put_str(
&mut self,
x: Coord,
y: Coord,
msg: &str,
fg: Attribute,
bg: Attribute
)
&mut self,
x: Coord,
y: Coord,
msg: &str,
fg: Attribute,
bg: Attribute
)
Writes a horizontal sequence of character cells without wrapping. This is just a quick and dirty way to write strings without providing many options.
fn set_clear_attributes(&mut self, fg: Attribute, bg: Attribute)
Sets what attributes should be used when clearing the output buffer with clear
.
fn set_cursor(&mut self, x: Coord, y: Coord)
Sets the position of the cursor. If invalid coordinates are provided, the cursor is hidden.
fn set_input_mode(&mut self, mode: InputMode)
Sets the method termbox should use to handle ESC sequences in the input buffer.
fn set_mouse_enabled(&mut self, enabled: bool)
Enables or disables mouse events. Mouse events are disabled by default.
fn set_output_mode(&mut self, mode: OutputMode)
Sets the method termbox should use to interpret output attributes.
fn width(&self) -> Coord
Returns the width of the output buffer in character cells.