Secure the cockpit
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Isaac Mills 2025-07-22 16:31:33 -06:00
parent 2cdd3aa886
commit cec70bc43b
Signed by: fnmain
GPG key ID: B67D7410F33A0F61

View file

@ -58,6 +58,7 @@ YJJJJJJJJJJJ???????????77777777777!!!!!!!!!!!~~~~~
const TABS: [&'static str; 3] = ["Whatzahoozits", "Thingamajigs", "Doohickeys"]; const TABS: [&'static str; 3] = ["Whatzahoozits", "Thingamajigs", "Doohickeys"];
const NUMBERS: [u32; 3] = [0, 4, 9]; const NUMBERS: [u32; 3] = [0, 4, 9];
const PASSWORD_BACKGROUND: Color = Color::Rgb(35, 35, 35);
impl App { impl App {
pub fn new() -> Self { pub fn new() -> Self {
@ -92,12 +93,12 @@ impl App {
{ {
self.tab = Tab::Rest; self.tab = Tab::Rest;
self.transition_instant = Instant::now(); self.transition_instant = Instant::now();
self.current_effect = fx::fade_from_fg( self.current_effect = fx::slide_in(
Color::Black, tachyonfx::Motion::UpToDown,
( 10,
self.transition_instant.elapsed().as_secs() as u32 + 200000, 0,
Interpolation::CircIn, PASSWORD_BACKGROUND,
), (500000, Interpolation::Linear),
); );
self.binary_search_hint.guess_hint = None; self.binary_search_hint.guess_hint = None;
} }
@ -109,6 +110,7 @@ impl App {
} }
pub fn draw_passcode(&mut self, frame: &mut Frame) { pub fn draw_passcode(&mut self, frame: &mut Frame) {
frame.render_widget(Block::new().bg(PASSWORD_BACKGROUND), frame.area());
let middle_vertical = Layout::new( let middle_vertical = Layout::new(
Direction::Vertical, Direction::Vertical,
[ [
@ -157,7 +159,7 @@ impl App {
Paragraph::new("Enter the secret code") Paragraph::new("Enter the secret code")
.alignment(ratatui::layout::Alignment::Center) .alignment(ratatui::layout::Alignment::Center)
.fg(Color::Rgb(226, 190, 89)) .fg(Color::Rgb(226, 190, 89))
.bg(Color::Black), .bg(PASSWORD_BACKGROUND),
layout[0], layout[0],
); );
frame.render_widget(&self.binary_search_hint, layout[1]); frame.render_widget(&self.binary_search_hint, layout[1]);
@ -173,7 +175,7 @@ impl App {
Paragraph::new(num) Paragraph::new(num)
.block(Block::new().borders(Borders::all())) .block(Block::new().borders(Borders::all()))
.fg(Color::Rgb(226, 190, 89)) .fg(Color::Rgb(226, 190, 89))
.bg(Color::Black), .bg(PASSWORD_BACKGROUND),
block, block,
); );
} }
@ -182,7 +184,7 @@ impl App {
Paragraph::new("Search the binary") Paragraph::new("Search the binary")
.alignment(ratatui::layout::Alignment::Center) .alignment(ratatui::layout::Alignment::Center)
.fg(Color::Rgb(226, 190, 89)) .fg(Color::Rgb(226, 190, 89))
.bg(Color::Black), .bg(PASSWORD_BACKGROUND),
layout[3], layout[3],
); );
} else { } else {
@ -190,7 +192,7 @@ impl App {
Paragraph::new("Maximize efficiency") Paragraph::new("Maximize efficiency")
.alignment(ratatui::layout::Alignment::Center) .alignment(ratatui::layout::Alignment::Center)
.fg(Color::Rgb(226, 190, 89)) .fg(Color::Rgb(226, 190, 89))
.bg(Color::Black), .bg(PASSWORD_BACKGROUND),
layout[3], layout[3],
); );
} }
@ -207,6 +209,7 @@ impl App {
.select(self.selected_tab) .select(self.selected_tab)
.fg(Color::Rgb(226, 190, 89)) .fg(Color::Rgb(226, 190, 89))
.bg(Color::Black) .bg(Color::Black)
.highlight_style(Style::new().bold())
.block(Block::new().borders(Borders::all()).title("Coming soon")), .block(Block::new().borders(Borders::all()).title("Coming soon")),
layout[0], layout[0],
); );
@ -258,7 +261,7 @@ impl App {
fx::effect_fn((), (200000, Interpolation::CircIn), |_, _, cells| { fx::effect_fn((), (200000, Interpolation::CircIn), |_, _, cells| {
cells.for_each(|(_, c)| c.fg = Color::Green); cells.for_each(|(_, c)| c.fg = Color::Green);
}), }),
fx::fade_to_fg(Color::Black, (200000, Interpolation::CircIn)), fx::fade_to_fg(PASSWORD_BACKGROUND, (200000, Interpolation::CircIn)),
]); ]);
} }
} }
@ -317,7 +320,7 @@ impl Widget for &BinarySearchHint {
let number_on = (number_on as f64 * ruler_scale) as u32; let number_on = (number_on as f64 * ruler_scale) as u32;
let mut style = Style::default() let mut style = Style::default()
.fg(Color::Rgb(226, 190, 89)) .fg(Color::Rgb(226, 190, 89))
.bg(Color::Black); .bg(PASSWORD_BACKGROUND);
if !self.range.contains(&number_on) { if !self.range.contains(&number_on) {
style = style.fg(Color::Rgb(117, 97, 42)); style = style.fg(Color::Rgb(117, 97, 42));
} }
@ -328,7 +331,7 @@ impl Widget for &BinarySearchHint {
let number_x = area.x + (*number_guessed as f64 / ruler_scale) as u16; let number_x = area.x + (*number_guessed as f64 / ruler_scale) as u16;
let style = Style::default() let style = Style::default()
.fg(Color::Rgb(226, 190, 89)) .fg(Color::Rgb(226, 190, 89))
.bg(Color::Black); .bg(PASSWORD_BACKGROUND);
buf.set_string(number_x, area.y, "|", style); buf.set_string(number_x, area.y, "|", style);
match NUMBERS[self.number_to_guess].cmp(number_guessed) { match NUMBERS[self.number_to_guess].cmp(number_guessed) {
Ordering::Less => buf.set_string(number_x, area.y + 1, "<", style), Ordering::Less => buf.set_string(number_x, area.y + 1, "<", style),
@ -339,10 +342,10 @@ impl Widget for &BinarySearchHint {
if let Some((last_guessed, guess_hint)) = self.guess_hint { if let Some((last_guessed, guess_hint)) = self.guess_hint {
let number_x = area.x + (last_guessed as f64 / ruler_scale) as u16; let number_x = area.x + (last_guessed as f64 / ruler_scale) as u16;
let style = Style::default().fg(Color::Red).bg(Color::Black); let style = Style::default().fg(Color::Red).bg(PASSWORD_BACKGROUND);
buf.set_string(number_x, area.y, "", style); buf.set_string(number_x, area.y, "", style);
let number_x = area.x + (guess_hint as f64 / ruler_scale) as u16; let number_x = area.x + (guess_hint as f64 / ruler_scale) as u16;
let style = Style::default().fg(Color::Green).bg(Color::Black); let style = Style::default().fg(Color::Green).bg(PASSWORD_BACKGROUND);
buf.set_string(number_x, area.y, "", style); buf.set_string(number_x, area.y, "", style);
} }
} }