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,7 +1,18 @@
use super::{ camera::get_screen_bounds, Attributes, Hidden, Map, Name, Pools, Position, Renderable, Rltk, World, RGB };
use super::{
camera::get_screen_bounds,
Attributes,
Hidden,
Map,
Name,
Pools,
Position,
Renderable,
World,
RGB,
};
use crate::TileType;
use crate::data::ids::*;
use rltk::prelude::*;
use bracket_lib::prelude::*;
use specs::prelude::*;
struct Tooltip {
@ -33,8 +44,15 @@ impl Tooltip {
fn height(&self) -> i32 {
return (self.lines.len() as i32) + 2i32;
}
fn render(&self, ctx: &mut Rltk, x: i32, y: i32) {
ctx.draw_box(x, y, self.width() - 1, self.height() - 1, RGB::named(WHITE), RGB::named(BLACK));
fn render(&self, ctx: &mut BTerm, x: i32, y: i32) {
ctx.draw_box(
x,
y,
self.width() - 1,
self.height() - 1,
RGB::named(WHITE),
RGB::named(BLACK)
);
for (i, s) in self.lines.iter().enumerate() {
ctx.print_color(x + 1, y + (i as i32) + 1, s.1, RGB::named(BLACK), &s.0);
}
@ -42,7 +60,7 @@ impl Tooltip {
}
#[rustfmt::skip]
pub fn draw_tooltips(ecs: &World, ctx: &mut Rltk, xy: Option<(i32, i32)>) {
pub fn draw_tooltips(ecs: &World, ctx: &mut BTerm, xy: Option<(i32, i32)>) {
let (min_x, _max_x, min_y, _max_y, x_offset, y_offset) = get_screen_bounds(ecs, ctx);
let map = ecs.fetch::<Map>();
let names = ecs.read_storage::<Name>();
@ -143,7 +161,7 @@ pub fn draw_tooltips(ecs: &World, ctx: &mut Rltk, xy: Option<(i32, i32)>) {
if tooltips.is_empty() { return ; }
let white = RGB::named(rltk::WHITE);
let white = RGB::named(WHITE);
let arrow;
let arrow_x;
@ -157,7 +175,7 @@ pub fn draw_tooltips(ecs: &World, ctx: &mut Rltk, xy: Option<(i32, i32)>) {
arrow = to_cp437('←');
arrow_x = mouse_pos.0 + 1;
}
ctx.set(arrow_x, arrow_y, white, RGB::named(rltk::BLACK), arrow);
ctx.set(arrow_x, arrow_y, white, RGB::named(BLACK), arrow);
let mut total_height = 0;
for t in tooltips.iter() {