Files
creaturedex/src/views/journal_view.rs
T

36 lines
975 B
Rust

use core::future;
use alloc::vec::Vec;
use embedded_graphics::pixelcolor::Rgb565;
use embedded_graphics::prelude::RgbColor;
use embedded_graphics_core::draw_target::DrawTarget;
use crate::{
card::model::Card, navigation::{navigation::{Action, Navigable, NewState}, outputs::Outputs}, views::view::View,
};
#[derive(Debug, Clone)]
pub struct JournalView {
pub cards: Vec<Card>,
pub selected_card: usize,
}
impl Navigable for JournalView {
fn display(&self, outputs: &mut Outputs) -> impl core::future::Future<Output = ()> + Send {
async move {
outputs.primary_display.clear(Rgb565::BLACK).unwrap();
}
}
fn handle_input(&self, input: Action) -> impl core::future::Future<Output = NewState> + Send {
let new_state = NewState {
view: View::Journal(self.clone()),
replace_view: true,
redraw: !matches!(input, Action::Timer),
};
future::ready(new_state)
}
}