Skip to content

Commit

Permalink
Update pixels to 0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
dtcristo committed Mar 23, 2023
1 parent 61c4195 commit a9589d8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [Unreleased]

### Changed

- Updated `pixels` to 0.12.

## [0.8.0] - 2022-12-20

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ x11 = ["bevy/x11"]

[dependencies]
bevy = { version = "0.9", default_features = false, features = ["bevy_winit"] }
pixels = "0.11"
pixels = "0.12"

[target.'cfg(target_arch = "wasm32")'.dependencies]
pollster = "0.2"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Use `PixelsResource` in your systems.
```rust
fn main_system(mut pixels_resource: ResMut<PixelsResource>) {
// Get a mutable slice for the pixel buffer
let frame: &mut [u8] = pixels_resource.pixels.get_frame_mut();
let frame: &mut [u8] = pixels_resource.pixels.frame_mut();

// Fill frame with pixel data
// ...
Expand Down
4 changes: 2 additions & 2 deletions examples/minimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ fn exit_on_escape(keyboard_input: Res<Input<KeyCode>>, mut app_exit_events: Even
}

fn draw_background(mut pixels_resource: ResMut<PixelsResource>) {
let frame = pixels_resource.pixels.get_frame_mut();
let frame = pixels_resource.pixels.frame_mut();
frame.copy_from_slice(&[0x48, 0xb2, 0xe8, 0xff].repeat(frame.len() / 4));
}

fn draw_objects(
mut pixels_resource: ResMut<PixelsResource>,
query: Query<(&Position, &Size, &Color)>,
) {
let frame = pixels_resource.pixels.get_frame_mut();
let frame = pixels_resource.pixels.frame_mut();
let frame_width_bytes = (WIDTH * 4) as usize;

for (position, size, color) in query.iter() {
Expand Down

0 comments on commit a9589d8

Please sign in to comment.