made the switch to using bracket-lib directly, instead of rltk wrapper

this should solve the build issues; it makes using the non-crashing github build a lot easier, because it lets the explicit rltk dependency be removed.
This commit is contained in:
Llywelwyn 2023-09-05 02:23:31 +01:00
parent 455b8f2d80
commit 85efe13dc5
93 changed files with 1528 additions and 770 deletions

View file

@ -1,6 +1,6 @@
use super::{ append_entry, LogFragment };
use crate::BUC;
use rltk::prelude::*;
use bracket_lib::prelude::*;
pub struct Logger {
current_colour: RGB,
@ -10,7 +10,7 @@ pub struct Logger {
impl Logger {
/// Creates a blank builder for making message log entries.
pub fn new() -> Self {
Logger { current_colour: RGB::named(rltk::WHITE), fragments: Vec::new() }
Logger { current_colour: RGB::named(WHITE), fragments: Vec::new() }
}
/// Sets the colour of the current message logger.
@ -42,11 +42,23 @@ impl Logger {
pub fn buc<T: ToString>(mut self, buc: BUC, cursed: Option<T>, blessed: Option<T>) -> Self {
if buc == BUC::Cursed && cursed.is_some() {
self.fragments.push(LogFragment { colour: RGB::named(SALMON), text: cursed.unwrap().to_string() });
self.fragments.push(LogFragment { colour: self.current_colour, text: ". ".to_string() });
self.fragments.push(LogFragment {
colour: RGB::named(SALMON),
text: cursed.unwrap().to_string(),
});
self.fragments.push(LogFragment {
colour: self.current_colour,
text: ". ".to_string(),
});
} else if buc == BUC::Blessed && blessed.is_some() {
self.fragments.push(LogFragment { colour: RGB::named(CYAN), text: blessed.unwrap().to_string() });
self.fragments.push(LogFragment { colour: self.current_colour, text: ". ".to_string() });
self.fragments.push(LogFragment {
colour: RGB::named(CYAN),
text: blessed.unwrap().to_string(),
});
self.fragments.push(LogFragment {
colour: self.current_colour,
text: ". ".to_string(),
});
}
return self;
}