modularize core

This commit is contained in:
🪞👃🪞 2024-06-30 22:47:17 +03:00
parent a4061535b5
commit 2837ffff4a
43 changed files with 629 additions and 770 deletions

View file

@ -1,4 +1,39 @@
use crate::prelude::*;
use crate::core::*;
use crate::layout::*;
pub fn draw_play_stop (buf: &mut Buffer, x: u16, y: u16, state: &TransportState) {
let style = Style::default().gray();
match state {
TransportState::Rolling => "▶ PLAYING",
TransportState::Starting => "READY ...",
TransportState::Stopped => "⏹ STOPPED",
}.blit(buf, x, y, Some(match state {
TransportState::Stopped => style.dim().bold(),
TransportState::Starting => style.not_dim().bold(),
TransportState::Rolling => style.not_dim().white().bold()
}));
}
pub fn draw_rec (buf: &mut Buffer, x: u16, y: u16, on: bool) {
"⏺ REC".blit(buf, x, y, Some(if on {
Style::default().bold().red()
} else {
Style::default().bold().dim()
}))
}
pub fn draw_dub (buf: &mut Buffer, x: u16, y: u16, on: bool) {
"⏺ DUB".blit(buf, x, y, Some(if on {
Style::default().bold().yellow()
} else {
Style::default().bold().dim()
}))
}
pub fn draw_mon (buf: &mut Buffer, x: u16, y: u16, on: bool) {
"⏺ MON".blit(buf, x, y, Some(if on {
Style::default().bold().green()
} else {
Style::default().bold().dim()
}))
}
pub struct Transport {
name: String,