refining the sprites

This commit is contained in:
Llywelwyn 2023-09-23 19:35:51 +01:00
parent d58614b106
commit 670b365def
6 changed files with 28 additions and 22 deletions

View file

@ -1,4 +1,11 @@
use super::{ State, RunState, tooltip::draw_tooltips, camera::get_screen_bounds };
use super::{
State,
RunState,
tooltip::draw_tooltips,
camera::get_screen_bounds,
VIEWPORT_H,
VIEWPORT_W,
};
use bracket_lib::prelude::*;
#[derive(PartialEq, Copy, Clone)]
@ -23,9 +30,8 @@ pub fn show_farlook(gs: &mut State, ctx: &mut BTerm) -> FarlookResult {
);
if let RunState::Farlook { x, y } = *runstate {
let (screen_x, screen_y) = (40, 30);
let x = x.clamp(x_offset, x_offset - 1 + (screen_x as i32));
let y = y.clamp(y_offset, y_offset - 1 + (screen_y as i32));
let x = x.clamp(x_offset, x_offset - 1 + VIEWPORT_W);
let y = y.clamp(y_offset, y_offset - 1 + VIEWPORT_H);
ctx.set(x, y, RGB::named(WHITE), RGB::named(BLACK), to_cp437('X'));
draw_tooltips(&gs.ecs, ctx, Some((x, y)));

View file

@ -1235,9 +1235,8 @@ pub fn ranged_target(
&gs.ecs,
ctx
);
let (screen_x, screen_y) = (40, 30);
let x = x.clamp(x_offset, x_offset - 1 + (screen_x as i32));
let y = y.clamp(y_offset, y_offset - 1 + (screen_y as i32));
let x = x.clamp(x_offset, x_offset - 1 + VIEWPORT_W);
let y = y.clamp(y_offset, y_offset - 1 + VIEWPORT_H);
let mut mouse_pos_adjusted = mouse_pos;
mouse_pos_adjusted.0 += min_x - x_offset;