Skip to content

Instantly share code, notes, and snippets.

@vojd
vojd / Cargo.toml
Last active October 3, 2023 18:47
Simple OpenGL window in Rust
[dependencies]
gl = "*"
glutin = "0.26"
winit = "0.24"
@vojd
vojd / read_pixel.rs
Created July 22, 2024 10:32
Bevy read pixel
/// Shows the basics of reading a pixel color value from an `Image` in Bevy
/// Pass in a handle to indicate which `Image` you're interested in
/// In this example I'm passing in a `LevelHandle` to snag an image used for a level
pub(crate) fn read_pixel(
query: Query<&Handle<Image>, With<LevelHandle>>,
images: Res<Assets<Image>>,
) {
let handle = query.single();
// the coordinates should be passed in through a Query