no need for scriptstate any more
This commit is contained in:
@@ -342,7 +342,7 @@ fn draw_play(frame: &mut Frame, game: &GameState, ui: &mut Ui) {
|
||||
.spacing(Spacing::Overlap(1))
|
||||
.areas(frame.area());
|
||||
frame.render_widget(
|
||||
StatusSidebarWidget(game.player),
|
||||
StatusSidebarWidget(game.player.clone()),
|
||||
sidebar_area,
|
||||
);
|
||||
rest
|
||||
|
||||
@@ -15,7 +15,7 @@ use ratatui::style::{Color, Style};
|
||||
use ratatui::symbols::merge::MergeStrategy;
|
||||
use ratatui::text::{Line, Span};
|
||||
use ratatui::widgets::{Block, Paragraph, Widget};
|
||||
use kiln_core::player::Player;
|
||||
use kiln_core::player::PlayerRef;
|
||||
|
||||
/// A filled heart: bright red.
|
||||
const HEART_FULL: Color = Color::Rgb(255, 0, 0);
|
||||
@@ -27,11 +27,11 @@ const HEART_EMPTY: Color = Color::Rgb(90, 0, 0);
|
||||
/// Shows a `Health:` label above a row of [`MAX_HEARTS`] heart glyphs, a
|
||||
/// `Gems: ♦ N` line, and a `Keys:` row of 8 `♀` glyphs colored when held
|
||||
/// and dark gray when absent.
|
||||
pub struct StatusSidebarWidget(pub Player);
|
||||
pub struct StatusSidebarWidget(pub PlayerRef);
|
||||
|
||||
impl Widget for StatusSidebarWidget {
|
||||
fn render(self, area: Rect, buf: &mut Buffer) {
|
||||
let player = self.0;
|
||||
let player = self.0.borrow();
|
||||
// One bright-red span per filled heart, dark-red for the rest, so a
|
||||
// partly-depleted bar reads at a glance.
|
||||
let filled = player.health;
|
||||
|
||||
Reference in New Issue
Block a user