turnage / valora

painting by functions
https://paytonturnage.gitbook.io/valora/
MIT License
702 stars 30 forks source link

typos in the gitbook #40

Closed mcginty closed 4 years ago

mcginty commented 4 years ago

Wasn't sure where your gitbook source is, but in the "Introduction page", there're two typos: "lib.rs" should be "main.rs", and in run_fn, the "world" variable is underscored when it is needed, while the "rng" variable is not underscored but should be.

Old

Put the following in your lib.rs:

use valora::prelude::*;

fn main() -> Result<()> {
    run_fn(Options::from_args(), |_gpu, _world, rng| {
        Ok(move |ctx: Context, canvas: &mut Canvas| {
            canvas.set_color(LinSrgb::new(1., 1., 1.));
            canvas.paint(Filled(ctx.world));

            let max_radius = world.width / 3.;
            let radius = ctx.time.as_secs_f32().cos().abs() * max_radius;

            canvas.set_color(LinSrgb::new(1., 0., 0.));
            canvas.paint(Filled(Ellipse::circle(world.center(), radius)));
        })
    })
}

New

Put the following in your main.rs:

use valora::prelude::*;

fn main() -> Result<()> {
    run_fn(Options::from_args(), |_gpu, world, _rng| {
        Ok(move |ctx: Context, canvas: &mut Canvas| {
            canvas.set_color(LinSrgb::new(1., 1., 1.));
            canvas.paint(Filled(ctx.world));

            let max_radius = world.width / 3.;
            let radius = ctx.time.as_secs_f32().cos().abs() * max_radius;

            canvas.set_color(LinSrgb::new(1., 0., 0.));
            canvas.paint(Filled(Ellipse::circle(world.center(), radius)));
        })
    })
}
turnage commented 4 years ago

Thank you for opening an issue! I've fixed the typos.