diff options
author | Iago Garrido <iago086@gmail.com> | 2019-11-18 20:56:58 +0100 |
---|---|---|
committer | Iago Garrido <iago086@gmail.com> | 2019-11-18 20:56:58 +0100 |
commit | 0a3b3bf177d54c68a22f061a7087d20d19488bba (patch) | |
tree | ea1bedebe13d48172f3d52ca6551804facf7c92d /src/state.rs | |
parent | 806ba04cfc6f225df9a3628fefd04578cefdbda5 (diff) |
add initial ui logic
Diffstat (limited to 'src/state.rs')
-rw-r--r-- | src/state.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/state.rs b/src/state.rs index cfda88c..2c5f16f 100644 --- a/src/state.rs +++ b/src/state.rs @@ -2,7 +2,7 @@ use crossterm::cursor::MoveTo; use crossterm::{queue, Output}; use std::io::{stdout, Write}; -use crate::entities::{Character, Entity}; +use crate::entities::{Character, Player, Entity}; use crate::tiling::{tile_to_str, TileGrid}; use crate::world::{Dungeon, Generatable, Level}; @@ -78,6 +78,17 @@ impl State { self.render_entity(&self.player) } + pub fn render_ui(&self) { + let mut sout = stdout(); + queue!( + sout, + MoveTo(0, (self.dungeon.ysize + 1) as u16), + Output(self.player.stats()) + ) + .unwrap(); + sout.flush().unwrap(); + } + pub fn current_level(&self) -> &Level { &self.dungeon.levels[self.level] } |