sprites init
This commit is contained in:
parent
8337f202cf
commit
cee4d02ce2
14 changed files with 319 additions and 50 deletions
|
|
@ -28,6 +28,7 @@ use bracket_lib::prelude::*;
|
|||
use serde::{ Deserialize, Serialize };
|
||||
use specs::prelude::*;
|
||||
use std::collections::HashMap;
|
||||
use crate::data::prelude::*;
|
||||
|
||||
#[derive(Serialize, Deserialize, Copy, Clone, PartialEq)]
|
||||
pub enum Ancestry {
|
||||
|
|
@ -112,7 +113,7 @@ pub enum CharCreateResult {
|
|||
|
||||
/// Handles the player character creation screen.
|
||||
pub fn character_creation(gs: &mut State, ctx: &mut BTerm) -> CharCreateResult {
|
||||
ctx.set_active_console(1);
|
||||
ctx.set_active_console(TEXT_LAYER);
|
||||
let runstate = gs.ecs.fetch::<RunState>();
|
||||
|
||||
let mut x = 2;
|
||||
|
|
@ -246,7 +247,7 @@ pub fn character_creation(gs: &mut State, ctx: &mut BTerm) -> CharCreateResult {
|
|||
}
|
||||
}
|
||||
}
|
||||
ctx.set_active_console(0);
|
||||
ctx.set_active_console(TILE_LAYER);
|
||||
return CharCreateResult::NoSelection { ancestry: Ancestry::Human, class: Class::Fighter };
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ use super::{
|
|||
BUC,
|
||||
data::ids::get_local_col,
|
||||
};
|
||||
use crate::data::prelude::*;
|
||||
use crate::data::entity::CARRY_CAPACITY_PER_STRENGTH;
|
||||
use crate::data::visuals::{
|
||||
TARGETING_LINE_COL,
|
||||
|
|
@ -110,7 +111,7 @@ pub fn draw_lerping_bar(
|
|||
pub const TEXT_FONT_MOD: i32 = 2;
|
||||
|
||||
pub fn draw_ui(ecs: &World, ctx: &mut BTerm) {
|
||||
ctx.set_active_console(1);
|
||||
ctx.set_active_console(TEXT_LAYER);
|
||||
// Render stats
|
||||
let pools = ecs.read_storage::<Pools>();
|
||||
let attributes = ecs.read_storage::<Attributes>();
|
||||
|
|
@ -474,7 +475,7 @@ pub fn draw_ui(ecs: &World, ctx: &mut BTerm) {
|
|||
|
||||
// Render the message log at [1, 7], ascending, with 7 lines and a max width of 68.
|
||||
gamelog::print_log(
|
||||
&mut BACKEND_INTERNAL.lock().consoles[1].console,
|
||||
&mut BACKEND_INTERNAL.lock().consoles[TEXT_LAYER].console,
|
||||
Point::new(1 * TEXT_FONT_MOD, 7),
|
||||
false,
|
||||
7,
|
||||
|
|
@ -539,7 +540,7 @@ pub fn draw_ui(ecs: &World, ctx: &mut BTerm) {
|
|||
RGB::named(WHITE),
|
||||
RGB::named(BLACK)
|
||||
); // Side box
|
||||
ctx.set_active_console(0);
|
||||
ctx.set_active_console(TILE_LAYER);
|
||||
tooltip::draw_tooltips(ecs, ctx, None);
|
||||
}
|
||||
|
||||
|
|
@ -999,7 +1000,7 @@ pub fn get_player_inventory(ecs: &World) -> PlayerInventory {
|
|||
}
|
||||
|
||||
pub fn show_inventory(gs: &mut State, ctx: &mut BTerm) -> (ItemMenuResult, Option<Entity>) {
|
||||
ctx.set_active_console(1);
|
||||
ctx.set_active_console(TEXT_LAYER);
|
||||
|
||||
let player_inventory = get_player_inventory(&gs.ecs);
|
||||
let count = player_inventory.len();
|
||||
|
|
@ -1021,7 +1022,7 @@ pub fn show_inventory(gs: &mut State, ctx: &mut BTerm) -> (ItemMenuResult, Optio
|
|||
ctx.draw_box(x, y, width + 2, (count + 1) as i32, RGB::named(WHITE), RGB::named(BLACK));
|
||||
print_options(&player_inventory, x + 1, y + 1, ctx);
|
||||
|
||||
ctx.set_active_console(0);
|
||||
ctx.set_active_console(TILE_LAYER);
|
||||
|
||||
match ctx.key {
|
||||
None => (ItemMenuResult::NoResponse, None),
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ use super::{
|
|||
};
|
||||
use crate::TileType;
|
||||
use crate::data::ids::*;
|
||||
use crate::data::prelude::*;
|
||||
use bracket_lib::prelude::*;
|
||||
use specs::prelude::*;
|
||||
|
||||
|
|
@ -45,7 +46,7 @@ impl Tooltip {
|
|||
return (self.lines.len() as i32) + 2i32;
|
||||
}
|
||||
fn render(&self, ctx: &mut BTerm, x: i32, y: i32) {
|
||||
ctx.set_active_console(1);
|
||||
ctx.set_active_console(TEXT_LAYER);
|
||||
ctx.draw_box(
|
||||
x,
|
||||
y,
|
||||
|
|
@ -57,7 +58,7 @@ impl Tooltip {
|
|||
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);
|
||||
}
|
||||
ctx.set_active_console(0);
|
||||
ctx.set_active_console(TILE_LAYER);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -177,9 +178,9 @@ pub fn draw_tooltips(ecs: &World, ctx: &mut BTerm, xy: Option<(i32, i32)>) {
|
|||
arrow = to_cp437('←');
|
||||
arrow_x = (mouse_pos.0 + 1) * 2;
|
||||
}
|
||||
ctx.set_active_console(1);
|
||||
ctx.set_active_console(TEXT_LAYER);
|
||||
ctx.set(arrow_x, arrow_y, white, RGB::named(BLACK), arrow);
|
||||
ctx.set_active_console(0);
|
||||
ctx.set_active_console(TILE_LAYER);
|
||||
|
||||
let mut total_height = 0;
|
||||
for t in tooltips.iter() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue