rename for clarity.
This commit is contained in:
parent
0680baddd5
commit
2352f3bfda
@ -13,7 +13,7 @@ use std::{io, time::Duration};
|
|||||||
fn main() {
|
fn main() {
|
||||||
let mut screen = Ui::init(io::stdout());
|
let mut screen = Ui::init(io::stdout());
|
||||||
let mut state = State::init(Difficulty::Mid);
|
let mut state = State::init(Difficulty::Mid);
|
||||||
screen.draw_board().or_crash();
|
screen.draw_static_elements().or_crash();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if poll(Duration::from_millis(250)).unwrap_or(false) {
|
if poll(Duration::from_millis(250)).unwrap_or(false) {
|
||||||
|
|||||||
@ -87,7 +87,7 @@ where
|
|||||||
|
|
||||||
if old_dimensions != (self.width, self.height) {
|
if old_dimensions != (self.width, self.height) {
|
||||||
self.clear()?;
|
self.clear()?;
|
||||||
self.draw_board()?;
|
self.draw_static_elements()?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -105,8 +105,8 @@ where
|
|||||||
/// changes to `self.ostream`.
|
/// changes to `self.ostream`.
|
||||||
///
|
///
|
||||||
/// NOTE: this function does not draw the static elements of the ui
|
/// NOTE: this function does not draw the static elements of the ui
|
||||||
/// using `Ui::draw_board()`. for efficiency these are only
|
/// using `Ui::draw_static_elements()`. for efficiency these are only
|
||||||
/// redrawn on screen dimensions changes.
|
/// redrawn on screen dimensions changes and initialization.
|
||||||
pub fn draw(&mut self, state: &State) -> io::Result<()> {
|
pub fn draw(&mut self, state: &State) -> io::Result<()> {
|
||||||
self.update_dimensions()?;
|
self.update_dimensions()?;
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ where
|
|||||||
///
|
///
|
||||||
/// NOTE: this function itself does not flush to `self.ostream`
|
/// NOTE: this function itself does not flush to `self.ostream`
|
||||||
/// in order to only have to flush once per frame.
|
/// in order to only have to flush once per frame.
|
||||||
pub fn draw_board(&mut self) -> io::Result<()> {
|
pub fn draw_static_elements(&mut self) -> io::Result<()> {
|
||||||
self.init_cursor_offset()?;
|
self.init_cursor_offset()?;
|
||||||
queue!(self.ostream, SetForegroundColor(Color::Reset))?;
|
queue!(self.ostream, SetForegroundColor(Color::Reset))?;
|
||||||
queue!(self.ostream, SetBackgroundColor(Color::Reset))?;
|
queue!(self.ostream, SetBackgroundColor(Color::Reset))?;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user