#raylib-rs initial setup?
29 messages · Page 1 of 1 (latest)
oh wait nvm
try installing libxrandr-dev
are you on fedora?
it looks like its libXrandr-devel instead of -dev
also, the macroquad package is based on raylib, but its entirely written in rust, so no external deps
glad i could be of help
try this: https://crates.io/crates/pixels
minimal example: https://github.com/parasyte/pixels/blob/2a9911571c305e0de30569facc948429f4e64535/examples/minimal-winit/src/main.rs
you need to install log, winit, and error_iter as well
hang on
this example is outdated
it does, but if you want to use those deps in your own code, you need to install them as well
the example is outdated, give me a sec
this is prob fixed using cargo add winit -F wayland
what are you actually trying to do with pixels?
are you going to export the noise to an image?
you could just use the image crate and skip the screen
it lets you just write pixels to a png or jpeg
drawing to a window is more compiclated
heres an example I used to generate a color map
use core::f32;
use image::{Rgb, RgbImage};
const PALETTE: [Rgb<u8>; 32] = [/* ... */];
fn color_dist(a: Rgb<u8>, b: Rgb<u8>) -> f32 {
let r_dist = b.0[0] as f32 - a.0[0] as f32;
let g_dist = b.0[1] as f32 - a.0[1] as f32;
let b_dist = b.0[2] as f32 - a.0[2] as f32;
(g_dist.powi(2) + r_dist.powi(2) + b_dist.powi(2)).sqrt()
}
fn main() {
let mut img = RgbImage::new(64, 64 * 64);
for r in 0..64 {
for g in 0..64 {
for b in 0..64 {
let target = Rgb([r as u8 * 4, g as u8 * 4, b as u8 * 4]);
let mut closest = PALETTE[0];
let mut min_dist = color_dist(target, closest);
for i in 1..PALETTE.len() {
let clr = PALETTE[i];
let dist = color_dist(target, clr);
if dist < min_dist {
min_dist = dist;
closest = clr;
}
}
img.put_pixel(r, g + b * 64, closest);
}
}
}
img.save("assets/texture/generated/palette_map.png")
.unwrap();
}
i would recommend using a shader to generate the noise + uniforms for control
this is something macroquad is quite good at
i think its called shadertoy or something
its built using macroquad's built-in gui library
check out the shadertoy as well
they have semi-working controls on it