Refactoring

This commit is contained in:
Nicolas 2022-04-09 13:01:36 +02:00
parent 5a233ccf4a
commit 1785f9eec5
3 changed files with 10 additions and 4 deletions

View File

@ -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]

View File

@ -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(())
}

View File

@ -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 }
}