initial
This commit is contained in:
parent
85881db62f
commit
4f899d329e
9 changed files with 121 additions and 67 deletions
|
|
@ -22,6 +22,21 @@ impl Logger {
|
|||
}
|
||||
|
||||
pub fn log(self) {
|
||||
append_entry(self.fragments)
|
||||
return append_entry(self.fragments);
|
||||
}
|
||||
|
||||
pub fn npc_name<T: ToString>(mut self, text: T) -> Self {
|
||||
self.fragments.push(LogFragment { colour: RGB::named(rltk::YELLOW), text: text.to_string() });
|
||||
return self;
|
||||
}
|
||||
|
||||
pub fn item_name<T: ToString>(mut self, text: T) -> Self {
|
||||
self.fragments.push(LogFragment { colour: RGB::named(rltk::CYAN), text: text.to_string() });
|
||||
return self;
|
||||
}
|
||||
|
||||
pub fn damage(mut self, damage: i32) -> Self {
|
||||
self.fragments.push(LogFragment { colour: RGB::named(rltk::RED), text: format!("{}", damage).to_string() });
|
||||
return self;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ lazy_static! {
|
|||
static ref LOG: Mutex<Vec<Vec<LogFragment>>> = Mutex::new(Vec::new());
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn append_fragment(fragment: LogFragment) {
|
||||
LOG.lock().unwrap().push(vec![fragment]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,6 @@ mod logstore;
|
|||
use logstore::*;
|
||||
pub use logstore::{clear_log, log_display};
|
||||
|
||||
pub struct GameLog {
|
||||
pub entries: Vec<String>,
|
||||
}
|
||||
|
||||
pub struct LogFragment {
|
||||
pub colour: RGB,
|
||||
pub text: String,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue