PistonDevelopers / piston

A modular game engine written in Rust

Home Page:https://www.piston.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to draw a polygon / polyline?

b12f opened this issue · comments

commented

Hi guys, I'm pretty new to both rust and piston, and I'm stuck on the following:

I've copy-pasted the polyline example into a file:

    draw.polyline()
        .thickness(thickness)
        .join_round()
        .colored_points(vertices);

and am getting the following error on build:

error[E0599]: no method named `thickness` found for type `nannou::draw::Drawing<'_, nannou::draw::properties::primitive::polyline::Vertexless>` in the current scope
  --> src/main.rs:59:10
   |
59 |         .thickness(thickness)
   |          ^^^^^^^^^ method not found in `nannou::draw::Drawing<'_, nannou::draw::properties::primitive::polyline::Vertexless>`

This is after renaming weight to thickness, as I've already noticed that there was an API change and Line also has a thickness method.

Now I really am not sure how to fix this. I've looked through the docs and there doesn't seem to be anything I can do with a Vertexless struct. In fact, none of the lines after .polyline() are valid at all, no matter what order.

How does this work? I know I'm supposed to hand over the vertices somehow, but I'm kinda stuck.

Thanks a lot!

commented

Wrong repo