I have gotten to the point in my project where I have everything set up to draw a GUI using piston_window as a backend. At first I noticed nothing drew to the screen. I have widgets being successfully created on event.update
inside the while let Some(event) = window.next()
loop, though I realised the GUI itself is not being drawn inside the window.draw_2d
function.
I'm not entirely sure if this is correct as I'm looking at code from the all_piston_window.rs example, but I also need to include a conrod::backend::piston::draw::primitives()
function inside of the draw function mentioned earlier, but no matter what I put after conrod::backend
(including piston, piston_window, winit and glium) I get an error compiling every time saying "Could not find `piston` in `backend`". I've checked the source - it's all right there, but it just doesn't seem to get picked up by the compiler?
I have tried adding --features "piston"
to cargo run
but it still fails on me. I have these libraries in my dependencies in order to get everything running fine, apart from this single error.
piston="^0.31.3"
piston_window="^0.61.0"
conrod="^0.51.1"
find_folder="^0.3.0"
Is there something I'm missing? I can provide more source code if necessary, though it's quite similar to the example I linked to above.
Hey @TomboFry, --features "piston"
will only work when trying to run or compile conrod or its examples directly. If you'd like to activate the piston
feature when using conrod as a dependency, the conrod entry under your [dependencies]
list should look like this:
conrod = { version = "^0.51.1", features = "piston" }
Hope this helps!
Ahhhh, yes, that makes complete sense! I noticed in the backend/mod.rs
file it has #[cfg(feature="piston")]
so I knew it would go somewhere, but I did not consider the config file as you suggested.
I got it working by turning features = "piston"
into an array, thank you very much for the help.
conrod = { version = "^0.51.1", features = ["piston"] }
Most helpful comment
Hey @TomboFry,
--features "piston"
will only work when trying to run or compile conrod or its examples directly. If you'd like to activate thepiston
feature when using conrod as a dependency, the conrod entry under your[dependencies]
list should look like this:Hope this helps!