2022-01-19 13:31:06 -05:00
|
|
|
mod enums;
|
2022-01-21 11:55:29 -05:00
|
|
|
mod menu;
|
2022-01-19 13:31:06 -05:00
|
|
|
mod tooltip;
|
|
|
|
|
2022-01-04 13:54:57 -05:00
|
|
|
use std::cmp::Ordering;
|
|
|
|
|
2022-01-21 11:55:29 -05:00
|
|
|
use ::rltk::{Point, Rltk, RGB};
|
2021-12-24 10:38:44 -05:00
|
|
|
use ::specs::prelude::*;
|
2022-01-19 13:31:06 -05:00
|
|
|
pub use enums::*;
|
2022-01-21 11:55:29 -05:00
|
|
|
pub use menu::*;
|
2022-01-19 13:31:06 -05:00
|
|
|
use tooltip::draw_tooltips;
|
2021-12-10 20:16:48 -05:00
|
|
|
|
2021-11-18 11:47:57 -05:00
|
|
|
use crate::components::{
|
2022-01-24 10:58:37 -05:00
|
|
|
Attribute, Attributes, Consumable, CursedItem, Duration, Equipped, HungerClock, HungerState,
|
2022-01-25 09:58:30 -05:00
|
|
|
InBackpack, KnownSpells, MagicItem, MagicItemClass, Name, ObfuscatedName, Pools, StatusEffect,
|
|
|
|
Viewshed,
|
2021-11-18 11:47:57 -05:00
|
|
|
};
|
2021-12-10 20:16:48 -05:00
|
|
|
use crate::game_log::GameLog;
|
2022-01-21 11:55:29 -05:00
|
|
|
use crate::{camera, colors, Map, MasterDungeonMap, State};
|
2022-01-19 09:40:21 -05:00
|
|
|
|
|
|
|
pub fn get_item_color(ecs: &World, item: Entity) -> RGB {
|
2022-01-21 11:18:53 -05:00
|
|
|
let dm = ecs.fetch::<crate::map::MasterDungeonMap>();
|
|
|
|
|
|
|
|
// If the item is cursed, and you have identified it, display it in red
|
|
|
|
if let Some(name) = ecs.read_storage::<Name>().get(item) {
|
|
|
|
if ecs.read_storage::<CursedItem>().get(item).is_some()
|
|
|
|
&& dm.identified_items.contains(&name.name)
|
|
|
|
{
|
|
|
|
return colors::RED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-19 09:40:21 -05:00
|
|
|
if let Some(magic) = ecs.read_storage::<MagicItem>().get(item) {
|
2022-01-21 11:18:53 -05:00
|
|
|
return match magic.class {
|
2022-01-19 09:40:21 -05:00
|
|
|
MagicItemClass::Common => colors::EQUIP_COMMON,
|
|
|
|
MagicItemClass::Rare => colors::EQUIP_RARE,
|
|
|
|
MagicItemClass::Legendary => colors::EQUIP_LEGEND,
|
2022-01-21 11:18:53 -05:00
|
|
|
};
|
2022-01-19 09:40:21 -05:00
|
|
|
}
|
2022-01-21 11:18:53 -05:00
|
|
|
|
|
|
|
colors::WHITE
|
2022-01-19 09:40:21 -05:00
|
|
|
}
|
2021-11-01 14:46:45 -04:00
|
|
|
|
2022-01-19 10:15:51 -05:00
|
|
|
pub fn get_item_display_name(ecs: &World, item: Entity) -> String {
|
|
|
|
if let Some(name) = ecs.read_storage::<Name>().get(item) {
|
|
|
|
if ecs.read_storage::<MagicItem>().get(item).is_some() {
|
|
|
|
let dm = ecs.fetch::<MasterDungeonMap>();
|
|
|
|
if dm.identified_items.contains(&name.name) {
|
2022-01-24 10:58:37 -05:00
|
|
|
if let Some(c) = ecs.read_storage::<Consumable>().get(item) {
|
|
|
|
if c.max_charges > 1 {
|
|
|
|
format!("{} ({})", name.name.clone(), c.charges)
|
|
|
|
} else {
|
|
|
|
name.name.clone()
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
name.name.clone()
|
|
|
|
}
|
2022-01-19 10:15:51 -05:00
|
|
|
} else if let Some(obfuscated) = ecs.read_storage::<ObfuscatedName>().get(item) {
|
|
|
|
obfuscated.name.clone()
|
|
|
|
} else {
|
|
|
|
"Unidentified magic item".to_string()
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
name.name.clone()
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
"Nameless item (bug)".to_string()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-04 12:12:08 -05:00
|
|
|
pub fn draw_hollow_box(
|
|
|
|
console: &mut Rltk,
|
|
|
|
sx: i32,
|
|
|
|
sy: i32,
|
|
|
|
width: i32,
|
|
|
|
height: i32,
|
|
|
|
fg: RGB,
|
|
|
|
bg: RGB,
|
|
|
|
) {
|
|
|
|
use rltk::to_cp437;
|
|
|
|
|
|
|
|
console.set(sx, sy, fg, bg, to_cp437('┌'));
|
|
|
|
console.set(sx + width, sy, fg, bg, to_cp437('┐'));
|
|
|
|
console.set(sx, sy + height, fg, bg, to_cp437('└'));
|
|
|
|
console.set(sx + width, sy + height, fg, bg, to_cp437('┘'));
|
|
|
|
|
|
|
|
for x in sx + 1..sx + width {
|
|
|
|
console.set(x, sy, fg, bg, to_cp437('─'));
|
|
|
|
console.set(x, sy + height, fg, bg, to_cp437('─'));
|
|
|
|
}
|
|
|
|
for y in sy + 1..sy + height {
|
|
|
|
console.set(sx, y, fg, bg, to_cp437('│'));
|
|
|
|
console.set(sx + width, y, fg, bg, to_cp437('│'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-01 14:46:45 -04:00
|
|
|
pub fn draw_ui(ecs: &World, ctx: &mut Rltk) {
|
2022-01-04 12:12:08 -05:00
|
|
|
use rltk::to_cp437;
|
2022-01-14 12:19:46 -05:00
|
|
|
|
|
|
|
draw_hollow_box(ctx, 0, 0, 79, 59, colors::BOX_GRAY, colors::BLACK); // Overall box
|
|
|
|
draw_hollow_box(ctx, 0, 0, 49, 45, colors::BOX_GRAY, colors::BLACK); // Map box
|
|
|
|
draw_hollow_box(ctx, 0, 45, 79, 14, colors::BOX_GRAY, colors::BLACK); // Log box
|
|
|
|
draw_hollow_box(ctx, 49, 0, 30, 8, colors::BOX_GRAY, colors::BLACK); // Top-right panel
|
|
|
|
|
|
|
|
ctx.set(0, 45, colors::BOX_GRAY, colors::BLACK, to_cp437('├'));
|
|
|
|
ctx.set(49, 8, colors::BOX_GRAY, colors::BLACK, to_cp437('├'));
|
|
|
|
ctx.set(49, 0, colors::BOX_GRAY, colors::BLACK, to_cp437('┬'));
|
|
|
|
ctx.set(49, 45, colors::BOX_GRAY, colors::BLACK, to_cp437('┴'));
|
|
|
|
ctx.set(79, 8, colors::BOX_GRAY, colors::BLACK, to_cp437('┤'));
|
|
|
|
ctx.set(79, 45, colors::BOX_GRAY, colors::BLACK, to_cp437('┤'));
|
2022-01-04 12:12:08 -05:00
|
|
|
|
|
|
|
// Draw the town name
|
|
|
|
let map = ecs.fetch::<Map>();
|
|
|
|
let name_length = map.name.len() + 2;
|
|
|
|
let x_pos = (22 - (name_length / 2)) as i32;
|
2022-01-14 12:19:46 -05:00
|
|
|
ctx.set(x_pos, 0, colors::BOX_GRAY, colors::BLACK, to_cp437('┤'));
|
2022-01-04 12:12:08 -05:00
|
|
|
ctx.set(
|
|
|
|
x_pos + name_length as i32,
|
2021-11-01 14:46:45 -04:00
|
|
|
0,
|
2022-01-14 12:19:46 -05:00
|
|
|
colors::BOX_GRAY,
|
|
|
|
colors::BLACK,
|
2022-01-04 12:12:08 -05:00
|
|
|
to_cp437('├'),
|
|
|
|
);
|
2022-01-14 12:19:46 -05:00
|
|
|
ctx.print_color(x_pos + 1, 0, colors::WHITE, colors::BLACK, &map.name);
|
2022-01-04 12:12:08 -05:00
|
|
|
std::mem::drop(map);
|
|
|
|
|
|
|
|
// Draw stats
|
|
|
|
let player_entity = ecs.fetch::<Entity>();
|
|
|
|
let pools = ecs.read_storage::<Pools>();
|
|
|
|
let player_pools = pools.get(*player_entity).unwrap();
|
|
|
|
let health = format!(
|
|
|
|
"Health: {}/{}",
|
|
|
|
player_pools.hit_points.current, player_pools.hit_points.max
|
|
|
|
);
|
|
|
|
let mana = format!(
|
|
|
|
"Mana: {}/{}",
|
|
|
|
player_pools.mana.current, player_pools.mana.max
|
|
|
|
);
|
2022-01-05 14:59:45 -05:00
|
|
|
let xp = format!("Level: {}", player_pools.level);
|
2022-01-14 12:19:46 -05:00
|
|
|
ctx.print_color(50, 1, colors::WHITE, colors::BLACK, &health);
|
|
|
|
ctx.print_color(50, 2, colors::WHITE, colors::BLACK, &mana);
|
|
|
|
ctx.print_color(50, 3, colors::WHITE, colors::BLACK, &xp);
|
2022-01-04 12:12:08 -05:00
|
|
|
ctx.draw_bar_horizontal(
|
|
|
|
64,
|
|
|
|
1,
|
|
|
|
14,
|
|
|
|
player_pools.hit_points.current,
|
|
|
|
player_pools.hit_points.max,
|
2022-01-14 12:19:46 -05:00
|
|
|
colors::RED,
|
|
|
|
colors::BLACK,
|
2021-11-01 14:46:45 -04:00
|
|
|
);
|
2022-01-04 12:12:08 -05:00
|
|
|
ctx.draw_bar_horizontal(
|
|
|
|
64,
|
2021-11-09 15:50:42 -05:00
|
|
|
2,
|
2022-01-04 12:12:08 -05:00
|
|
|
14,
|
|
|
|
player_pools.mana.current,
|
|
|
|
player_pools.mana.max,
|
2022-01-14 12:19:46 -05:00
|
|
|
colors::BLUE,
|
|
|
|
colors::BLACK,
|
2021-11-09 15:50:42 -05:00
|
|
|
);
|
2022-01-05 14:59:45 -05:00
|
|
|
let xp_level_start = (player_pools.level - 1) * 1000;
|
|
|
|
ctx.draw_bar_horizontal(
|
|
|
|
64,
|
|
|
|
3,
|
|
|
|
14,
|
|
|
|
player_pools.xp - xp_level_start,
|
|
|
|
1000,
|
2022-01-14 12:19:46 -05:00
|
|
|
colors::GOLD,
|
|
|
|
colors::BLACK,
|
2022-01-05 14:59:45 -05:00
|
|
|
);
|
2022-01-04 12:24:04 -05:00
|
|
|
|
|
|
|
// Attributes
|
|
|
|
let attributes = ecs.read_storage::<Attributes>();
|
|
|
|
let attr = attributes.get(*player_entity).unwrap();
|
|
|
|
draw_attribute("Might:", &attr.might, 4, ctx);
|
|
|
|
draw_attribute("Quickness:", &attr.quickness, 5, ctx);
|
|
|
|
draw_attribute("Fitness:", &attr.fitness, 6, ctx);
|
|
|
|
draw_attribute("Intelligence:", &attr.intelligence, 7, ctx);
|
|
|
|
|
2022-01-13 10:29:58 -05:00
|
|
|
// Initiative and weight
|
|
|
|
ctx.print_color(
|
|
|
|
50,
|
|
|
|
9,
|
2022-01-14 12:19:46 -05:00
|
|
|
colors::WHITE,
|
|
|
|
colors::BLACK,
|
2022-01-13 10:29:58 -05:00
|
|
|
&format!(
|
|
|
|
"{:.0} lbs ({} lbs max)",
|
|
|
|
player_pools.total_weight,
|
|
|
|
(attr.might.base + attr.might.modifiers) * 15
|
|
|
|
),
|
|
|
|
);
|
|
|
|
ctx.print_color(
|
|
|
|
50,
|
|
|
|
10,
|
2022-01-14 12:19:46 -05:00
|
|
|
colors::WHITE,
|
|
|
|
colors::BLACK,
|
2022-01-13 10:29:58 -05:00
|
|
|
&format!(
|
|
|
|
"Initiative Penalty: {:.0}",
|
|
|
|
player_pools.total_initiative_penalty
|
|
|
|
),
|
|
|
|
);
|
2022-01-13 10:42:02 -05:00
|
|
|
ctx.print_color(
|
|
|
|
50,
|
|
|
|
11,
|
2022-01-14 12:19:46 -05:00
|
|
|
colors::GOLD,
|
|
|
|
colors::BLACK,
|
2022-01-13 10:42:02 -05:00
|
|
|
&format!("Gold: {:.1}", player_pools.gold),
|
|
|
|
);
|
2022-01-13 10:29:58 -05:00
|
|
|
|
2022-01-04 12:24:04 -05:00
|
|
|
// Equipped
|
2022-01-13 10:29:58 -05:00
|
|
|
let mut y = 13;
|
2022-01-19 09:40:21 -05:00
|
|
|
let entities = ecs.entities();
|
2022-01-04 12:24:04 -05:00
|
|
|
let equipped = ecs.read_storage::<Equipped>();
|
2022-01-19 10:15:51 -05:00
|
|
|
for (entity, equipped_by) in (&entities, &equipped).join() {
|
2022-01-04 12:24:04 -05:00
|
|
|
if equipped_by.owner == *player_entity {
|
2022-01-19 09:40:21 -05:00
|
|
|
ctx.print_color(
|
|
|
|
50,
|
|
|
|
y,
|
|
|
|
get_item_color(ecs, entity),
|
|
|
|
colors::BLACK,
|
2022-01-19 10:15:51 -05:00
|
|
|
&get_item_display_name(ecs, entity),
|
2022-01-19 09:40:21 -05:00
|
|
|
);
|
2022-01-04 12:24:04 -05:00
|
|
|
y += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Consumables
|
|
|
|
y += 1;
|
|
|
|
let consumables = ecs.read_storage::<Consumable>();
|
|
|
|
let backpack = ecs.read_storage::<InBackpack>();
|
|
|
|
let mut index = 1;
|
2022-01-19 10:15:51 -05:00
|
|
|
for (entity, carried_by, _consumable) in (&entities, &backpack, &consumables).join() {
|
2022-01-04 12:24:04 -05:00
|
|
|
if carried_by.owner == *player_entity && index < 10 {
|
2022-01-14 12:19:46 -05:00
|
|
|
ctx.print_color(50, y, colors::YELLOW, colors::BLACK, &format!("↑{}", index));
|
2022-01-19 09:40:21 -05:00
|
|
|
ctx.print_color(
|
|
|
|
53,
|
|
|
|
y,
|
|
|
|
get_item_color(ecs, entity),
|
|
|
|
colors::BLACK,
|
2022-01-19 10:15:51 -05:00
|
|
|
&get_item_display_name(ecs, entity),
|
2022-01-19 09:40:21 -05:00
|
|
|
);
|
2022-01-04 12:24:04 -05:00
|
|
|
y += 1;
|
|
|
|
index += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-25 09:58:30 -05:00
|
|
|
// Spells
|
|
|
|
y += 1;
|
|
|
|
let known_spells_storage = ecs.read_storage::<KnownSpells>();
|
|
|
|
let known_spells = &known_spells_storage.get(*player_entity).unwrap().spells;
|
|
|
|
let mut index = 1;
|
|
|
|
for spell in known_spells.iter() {
|
|
|
|
ctx.print_color(50, y, colors::CYAN, colors::BLACK, &format!("^{}", index));
|
|
|
|
ctx.print_color(
|
|
|
|
53,
|
|
|
|
y,
|
|
|
|
colors::CYAN,
|
|
|
|
colors::BLACK,
|
|
|
|
&format!("{} ({})", spell.display_name, spell.mana_cost),
|
|
|
|
);
|
|
|
|
index += 1;
|
|
|
|
y += 1;
|
|
|
|
}
|
|
|
|
|
2022-01-04 12:24:04 -05:00
|
|
|
// Status
|
2022-01-24 10:58:37 -05:00
|
|
|
y = 44;
|
2022-01-04 12:24:04 -05:00
|
|
|
let hunger = ecs.read_storage::<HungerClock>();
|
|
|
|
let hc = hunger.get(*player_entity).unwrap();
|
|
|
|
match hc.state {
|
2022-01-24 11:19:31 -05:00
|
|
|
HungerState::WellFed => {
|
|
|
|
ctx.print_color(50, y, colors::GREEN, colors::BLACK, "Well Fed");
|
|
|
|
y -= 1;
|
|
|
|
}
|
2022-01-04 12:24:04 -05:00
|
|
|
HungerState::Normal => {}
|
2022-01-24 11:19:31 -05:00
|
|
|
HungerState::Hungry => {
|
|
|
|
ctx.print_color(50, y, colors::ORANGE, colors::BLACK, "Hungry");
|
|
|
|
y -= 1;
|
|
|
|
}
|
|
|
|
HungerState::Starving => {
|
|
|
|
ctx.print_color(50, y, colors::RED, colors::BLACK, "Starving");
|
|
|
|
y -= 1;
|
|
|
|
}
|
2022-01-04 12:24:04 -05:00
|
|
|
}
|
2022-01-24 10:58:37 -05:00
|
|
|
let statuses = ecs.read_storage::<StatusEffect>();
|
|
|
|
let durations = ecs.read_storage::<Duration>();
|
|
|
|
let names = ecs.read_storage::<Name>();
|
|
|
|
for (status, duration, name) in (&statuses, &durations, &names).join() {
|
|
|
|
if status.target == *player_entity {
|
|
|
|
ctx.print_color(
|
|
|
|
50,
|
|
|
|
y,
|
|
|
|
colors::RED,
|
|
|
|
colors::BLACK,
|
|
|
|
&format!("{} ({})", name.name, duration.turns),
|
|
|
|
);
|
|
|
|
y -= 1;
|
|
|
|
}
|
|
|
|
}
|
2022-01-04 12:24:04 -05:00
|
|
|
|
|
|
|
// Draw the log
|
|
|
|
let log = ecs.fetch::<GameLog>();
|
|
|
|
let mut y = 46;
|
|
|
|
for s in log.entries.iter().rev() {
|
|
|
|
if y < 59 {
|
|
|
|
ctx.print(2, y, s);
|
|
|
|
}
|
|
|
|
y += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
draw_tooltips(ecs, ctx);
|
2022-01-04 12:12:08 -05:00
|
|
|
}
|
2021-11-09 15:50:42 -05:00
|
|
|
|
2022-01-04 12:12:08 -05:00
|
|
|
fn draw_attribute(name: &str, attribute: &Attribute, y: i32, ctx: &mut Rltk) {
|
2022-01-14 12:19:46 -05:00
|
|
|
ctx.print_color(50, y, colors::ATTR_GRAY, colors::BLACK, name);
|
2022-01-04 12:12:08 -05:00
|
|
|
|
2022-01-04 13:54:57 -05:00
|
|
|
let color = match attribute.modifiers.cmp(&0) {
|
2022-01-14 12:19:46 -05:00
|
|
|
Ordering::Less => colors::RED,
|
|
|
|
Ordering::Equal => colors::WHITE,
|
|
|
|
Ordering::Greater => colors::GREEN,
|
2022-01-04 12:12:08 -05:00
|
|
|
};
|
2022-01-04 13:54:57 -05:00
|
|
|
|
2022-01-04 12:12:08 -05:00
|
|
|
ctx.print_color(
|
|
|
|
67,
|
|
|
|
y,
|
|
|
|
color,
|
2022-01-14 12:19:46 -05:00
|
|
|
colors::BLACK,
|
2022-01-04 12:12:08 -05:00
|
|
|
&format!("{}", attribute.base + attribute.modifiers),
|
|
|
|
);
|
2022-01-14 12:19:46 -05:00
|
|
|
ctx.print_color(73, y, color, colors::BLACK, &format!("{}", attribute.bonus));
|
2021-11-01 14:46:45 -04:00
|
|
|
|
2022-01-04 12:12:08 -05:00
|
|
|
if attribute.bonus > 0 {
|
2022-01-14 12:19:46 -05:00
|
|
|
ctx.set(72, y, color, colors::BLACK, rltk::to_cp437('+'));
|
2021-11-01 14:46:45 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-05 10:42:44 -04:00
|
|
|
pub fn ranged_target(
|
|
|
|
gs: &mut State,
|
|
|
|
ctx: &mut Rltk,
|
|
|
|
range: i32,
|
|
|
|
) -> (ItemMenuResult, Option<Point>) {
|
2021-12-17 16:35:30 -05:00
|
|
|
let (min_x, max_x, min_y, max_y) = camera::get_screen_bounds(&gs.ecs, ctx);
|
2021-11-05 10:42:44 -04:00
|
|
|
let player_entity = gs.ecs.fetch::<Entity>();
|
|
|
|
let player_pos = gs.ecs.fetch::<Point>();
|
|
|
|
let viewsheds = gs.ecs.read_storage::<Viewshed>();
|
|
|
|
|
2022-01-14 12:19:46 -05:00
|
|
|
ctx.print_color(5, 0, colors::YELLOW, colors::BLACK, "Select Target:");
|
2021-11-05 10:42:44 -04:00
|
|
|
|
|
|
|
// Highlight available target cells
|
|
|
|
let mut available_cells = Vec::new();
|
2021-11-19 19:52:15 -05:00
|
|
|
if let Some(visible) = viewsheds.get(*player_entity) {
|
2021-11-05 10:42:44 -04:00
|
|
|
for idx in visible.visible_tiles.iter() {
|
|
|
|
let distance = rltk::DistanceAlg::Pythagoras.distance2d(*player_pos, *idx);
|
|
|
|
if distance <= range as f32 {
|
2021-12-17 16:35:30 -05:00
|
|
|
let screen_x = idx.x - min_x;
|
|
|
|
let screen_y = idx.y - min_y;
|
|
|
|
|
|
|
|
if screen_x > 1
|
|
|
|
&& screen_x < (max_x - min_x) - 1
|
|
|
|
&& screen_y > 1
|
|
|
|
&& screen_y < (max_y - min_y) - 1
|
|
|
|
{
|
2022-01-14 12:19:46 -05:00
|
|
|
ctx.set_bg(screen_x, screen_y, colors::BLUE);
|
2021-12-17 16:35:30 -05:00
|
|
|
available_cells.push(idx);
|
|
|
|
}
|
2021-11-05 10:42:44 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return (ItemMenuResult::Cancel, None);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw mouse cursor
|
|
|
|
let mouse_pos = ctx.mouse_pos();
|
2021-12-17 16:35:30 -05:00
|
|
|
let mut mouse_map_pos = mouse_pos;
|
|
|
|
mouse_map_pos.0 += min_x;
|
|
|
|
mouse_map_pos.1 += min_y;
|
2021-11-05 10:42:44 -04:00
|
|
|
let mut valid_target = false;
|
|
|
|
for idx in available_cells.iter() {
|
2021-12-17 16:35:30 -05:00
|
|
|
if idx.x == mouse_map_pos.0 && idx.y == mouse_map_pos.1 {
|
2021-11-05 10:42:44 -04:00
|
|
|
valid_target = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if valid_target {
|
2022-01-14 12:19:46 -05:00
|
|
|
ctx.set_bg(mouse_pos.0, mouse_pos.1, colors::CYAN);
|
2021-11-05 10:42:44 -04:00
|
|
|
if ctx.left_click {
|
|
|
|
return (
|
|
|
|
ItemMenuResult::Selected,
|
2021-12-17 16:35:30 -05:00
|
|
|
Some(Point::new(mouse_map_pos.0, mouse_map_pos.1)),
|
2021-11-05 10:42:44 -04:00
|
|
|
);
|
|
|
|
}
|
|
|
|
} else {
|
2022-01-14 12:19:46 -05:00
|
|
|
ctx.set_bg(mouse_pos.0, mouse_pos.1, colors::RED);
|
2021-11-05 10:42:44 -04:00
|
|
|
if ctx.left_click {
|
|
|
|
return (ItemMenuResult::Cancel, None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
(ItemMenuResult::NoResponse, None)
|
|
|
|
}
|