7 releases (breaking)

0.6.0 Nov 8, 2023
0.5.0 Jul 12, 2023
0.4.0 Mar 15, 2023
0.3.0 Dec 12, 2022
0.1.1 Aug 11, 2022

#178 in Rendering

Download history 23/week @ 2023-08-15 6/week @ 2023-08-22 24/week @ 2023-08-29 20/week @ 2023-09-05 12/week @ 2023-09-12 18/week @ 2023-09-19 9/week @ 2023-09-26 16/week @ 2023-10-03 20/week @ 2023-10-10 16/week @ 2023-10-17 25/week @ 2023-10-24 29/week @ 2023-10-31 49/week @ 2023-11-07 21/week @ 2023-11-14 32/week @ 2023-11-21 49/week @ 2023-11-28

151 downloads per month

MIT license

82KB
1.5K SLoC

bevy_pixel_buffer

Crates.io docs.rs Crates.io

A library to draw pixels in bevy.

  • Easy to set up and use.
  • Can be integrated into an existing project.
  • Allows dynamic resize of the pixel buffer to fill an area such as the window.
  • Support for multiple pixel buffers.
  • Allows to easily attach a compute shader to update the pixels.
  • egui integration (through bevy_egui) to show the pixels inside the UI.

Examples

A basic example,

use bevy::prelude::*;
use bevy_pixel_buffer::prelude::*;

fn main() {
    let size = PixelBufferSize {
        size: UVec2::new(32, 32),       // amount of pixels
        pixel_size: UVec2::new(16, 16), // size of each pixel in the screen
    };

    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugins(PixelBufferPlugin)  // Add this plugin
        .add_systems(Startup, pixel_buffer_setup(size)) // Setup system
        .add_systems(Update, update)
        .run()
}

fn update(mut pb: QueryPixelBuffer) {
    // Set each pixel to a random color
    pb.frame().per_pixel(|_, _| Pixel::random());
}

Basic example output

More examples

Features

  • egui*. Egui integration.
  • rayon. Enables extra alternative functions that use rayon.
  • rand. Enables extra functionality related to random values.

* Disabled by default.

Bevy versions

Version compatibility table.

bevy bevy_pixel_buffer
0.12 0.6
0.11 0.5
0.10 0.4
0.9 0.3
0.8 0.2

Dependencies

~33–73MB
~1M SLoC