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