Create consoles without bg from the builder
@@ -11,7 +11,8 @@ struct BuilderFont {
/// Internal enum defining a console to be loaded.
enum ConsoleType {
SimpleConsole{ width: u32, height: u32, font: String },
- SparseConsole{ width: u32, height: u32, font: String }
+ SparseConsole{ width: u32, height: u32, font: String },
+ SparseConsoleNoBg{ width: u32, height: u32, font: String }
}
/// Provides a builder mechanism for initializing RLTK. You can chain builders together,
@@ -228,6 +229,18 @@ impl RltkBuilder {
self
}
+ /// Adds a sparse console with no bg rendering layer to the RLTK builder.
+ pub fn with_sparse_console_no_bg<S:ToString, T>(mut self, width: T, height: T, font: S) -> Self
+ where T: TryInto<u32>
+ {
+ self.consoles.push(ConsoleType::SparseConsoleNoBg{
+ width : width.try_into().ok().unwrap(),
+ height : height.try_into().ok().unwrap(),
+ font : font.to_string()
+ });
+ self
+ }
+
/// Enables you to override the vsync default for native rendering.
pub fn with_vsync(mut self, vsync : bool) -> Self {
self.platform_hints.vsync = vsync;
@@ -268,6 +281,11 @@ impl RltkBuilder {
let font_id = font_map[&font_path];
context.register_console(SparseConsole::init(*width, *height, &context.backend), font_id);
}
+ ConsoleType::SparseConsoleNoBg{width, height, font} => {
+ let font_path = format!("{}/{}", self.resource_path, font);
+ let font_id = font_map[&font_path];
+ context.register_console_no_bg(SparseConsole::init(*width, *height, &context.backend), font_id);
+ }
}
}
