Shadow0133

u/Shadow0133


r/rust_gamedev•

trying to use ggez 0.8.1

question:snoo_thoughtful:

edit: nvm, updating to 0.9.0-rc0 fixed it

let mut canvas = Canvas::from_frame(ctx, Color::BLACK);
let (w, h) = ctx.gfx.drawable_size();
Quad.draw(
    &mut canvas,
    DrawParam::default()
        .scale([30.0; 2])
        .dest([w / 2.0, h / 2.0])
        .color(Color::BLUE),
);
Text::new("foo")
    .draw(&mut canvas, DrawParam::default().color(Color::WHITE));
canvas.finish(ctx)

with this code in EventHandler::draw, i'm trying to draw text in top-left corner and square in the middle of the screen, but i'm getting just text.

40


r/QuarkMod•

Sign Editing allows to edit sign after it's been already placed. So it's not necessary to have sign GUI open when placing.

Option to disable gui on placement would be very useful in situations when player is placing many signs (for shaping water streams or constructing certain farms).

91


I want to make a ksp controller from a external USB MIDI controller (M-Audio Axiom Air Mini 32).

I've already got code to read inputs from it (written in Rust). At first I though about making it a virtual xbox 360 controller. But using a mod will probably give me a better control over how inputs are mapped to game actions.

Which mods do you recommend for inter-process communication? I'm thinking about using krpc right now, but I've read that simpit might be a better option.

I also don't want to use arduino, simply because I don't have one.

136

r/rust•

I'm writing helper library for minifb. It allows to split buffer ([u32]) into windows, like tmux split-window -{v,h}. There is some raw pointer juggling, but I think it's safe. Miri doesn't shows any errors.

Main part is fn split_{v,h}(&mut self, pos: usize) -> Option<(FBWindow, FBWindow)>, where split_h can't be implemented using safe Rust (or, at least, easily).

With split_v, you have top and bottom part, which you could implement using split_at_mut. But for split_h, you would have two overlapping mutable slice, which is illegal. You could hold Vec<&mut [u32]> with slice per line, but it would somewhat inefficient. So FBWindow hold pointer to st

58


r/rust•

Pixelflut is a very simple (and inefficient) ASCII based network protocol to draw pixels on a screen. You can write a basic client in a single line of shell code if you want, but you only get to change a single pixel at a time.

I decided to learn async by implementing a simple Pixelflut server. Here is the repo. Constructive criticism and patches welcome.

For parsing messages, I tried using tokio_codec (which has outdated deps) and tokio_util with "codec" feature (which didn't work correctly with timeout), so I ended up using AsyncBufRead instead. There is still an issue with updating window

72