mirror of
https://github.com/ricoriedel/wipe.git
synced 2024-11-22 16:06:38 +00:00
Refactoring
This commit is contained in:
parent
5a233ccf4a
commit
1785f9eec5
@ -1,5 +1,4 @@
|
|||||||
use crossterm::style::Color;
|
use crossterm::style::Color;
|
||||||
use crossterm::style::Color::*;
|
|
||||||
|
|
||||||
/// A collection of colors.
|
/// A collection of colors.
|
||||||
pub trait ColorSampler {
|
pub trait ColorSampler {
|
||||||
@ -31,6 +30,7 @@ impl ColorSampler for SimpleColorSampler {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
|
use crossterm::style::Color::*;
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
@ -1,13 +1,17 @@
|
|||||||
|
use std::io::stdout;
|
||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use clap::ArgEnum;
|
use clap::ArgEnum;
|
||||||
use crossterm::style::Color::*;
|
use crossterm::style::Color::*;
|
||||||
use crate::animation::Animation;
|
use crate::animation::Animation;
|
||||||
use crate::animation::circle::CircleAnimation;
|
use crate::animation::circle::CircleAnimation;
|
||||||
|
use crate::char::SimpleCharSampler;
|
||||||
use crate::color::{ColorSampler, SimpleColorSampler};
|
use crate::color::{ColorSampler, SimpleColorSampler};
|
||||||
use crate::fill::circle::CircleFillMode;
|
use crate::fill::circle::CircleFillMode;
|
||||||
use crate::fill::FillMode;
|
use crate::fill::FillMode;
|
||||||
use crate::fill::level::LevelFillMode;
|
use crate::fill::level::LevelFillMode;
|
||||||
|
use crate::sampler::ComposedSampler;
|
||||||
|
use crate::surface::WriteSurface;
|
||||||
use crate::vec::Vector;
|
use crate::vec::Vector;
|
||||||
|
|
||||||
mod color;
|
mod color;
|
||||||
@ -70,6 +74,10 @@ fn main() -> Result<(), Error> {
|
|||||||
let animation = create_animation(args.animation[0], size);
|
let animation = create_animation(args.animation[0], size);
|
||||||
let fill = create_fill(args.fill[0], size);
|
let fill = create_fill(args.fill[0], size);
|
||||||
let color = create_color(args.color[0]);
|
let color = create_color(args.color[0]);
|
||||||
|
let char = Box::new(SimpleCharSampler::new(args.chars));
|
||||||
|
|
||||||
|
let _ = Box::new(ComposedSampler::new(animation, fill, color, char));
|
||||||
|
let _ = Box::new(WriteSurface::new(stdout(), width, height));
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,7 @@ pub struct Vector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Vector {
|
impl Vector {
|
||||||
pub const ZERO: Vector = Vector::new(0.0, 0.0);
|
pub fn new(x: f32, y: f32) -> Self {
|
||||||
|
|
||||||
pub const fn new(x: f32, y: f32) -> Self {
|
|
||||||
Self { x, y }
|
Self { x, y }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user