Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "pixels"
description = "A tiny library providing a GPU-powered pixel frame buffer."
version = "0.16.0"
authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2021"
edition = "2024"
rust-version = "1.88.0"
repository = "https://github.com/parasyte/pixels"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion examples/conway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "conway"
version = "0.1.0"
authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2021"
edition = "2024"
publish = false

[features]
Expand Down
12 changes: 6 additions & 6 deletions examples/conway/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ fn main() -> Result<(), Error> {
}
}
// Resize the window
if let Some(size) = input.window_resized() {
if let Err(err) = pixels.resize_surface(size.width, size.height) {
log_error("pixels.resize_surface", err);
elwt.exit();
return;
}
if let Some(size) = input.window_resized()
&& let Err(err) = pixels.resize_surface(size.width, size.height)
{
log_error("pixels.resize_surface", err);
elwt.exit();
return;
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/custom-shader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "custom-shader"
version = "0.1.0"
authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2021"
edition = "2024"
publish = false

[features]
Expand Down
3 changes: 1 addition & 2 deletions examples/custom-shader/src/renderers.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use pixels::{
check_texture_size,
TextureError, check_texture_size,
wgpu::{self, util::DeviceExt},
TextureError,
};

pub(crate) struct NoiseRenderer {
Expand Down
2 changes: 1 addition & 1 deletion examples/imgui-winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "imgui-winit"
version = "0.1.0"
authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2021"
edition = "2024"
publish = false

[features]
Expand Down
2 changes: 1 addition & 1 deletion examples/imgui-winit/src/gui.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use pixels::{wgpu, PixelsContext};
use pixels::{PixelsContext, wgpu};
use std::time::Instant;

/// Manages all state required for rendering Dear ImGui over `Pixels`.
Expand Down
31 changes: 16 additions & 15 deletions examples/imgui-winit/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,22 @@ fn main() -> Result<(), Error> {
}

// Resize the window
if let Some(size) = input.window_resized() {
if size.width > 0 && size.height > 0 {
// Resize the surface texture
if let Err(err) = pixels.resize_surface(size.width, size.height) {
log_error("pixels.resize_surface", err);
return event_loop.exit();
}

// Resize the world
let LogicalSize { width, height } = size.to_logical(scale_factor);
world.resize(width, height);
if let Err(err) = pixels.resize_buffer(width, height) {
log_error("pixels.resize_buffer", err);
return event_loop.exit();
}
if let Some(size) = input.window_resized()
&& size.width > 0
&& size.height > 0
{
// Resize the surface texture
if let Err(err) = pixels.resize_surface(size.width, size.height) {
log_error("pixels.resize_surface", err);
return event_loop.exit();
}

// Resize the world
let LogicalSize { width, height } = size.to_logical(scale_factor);
world.resize(width, height);
if let Err(err) = pixels.resize_buffer(width, height) {
log_error("pixels.resize_buffer", err);
return event_loop.exit();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/invaders/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "invaders"
version = "0.1.0"
authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2021"
edition = "2024"
publish = false

[features]
Expand Down
16 changes: 6 additions & 10 deletions examples/invaders/simple-invaders/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,18 +408,14 @@ impl World {
let width = self.player.sprite.width();

match controls.direction {
Direction::Left => {
if self.player.pos.x > width {
self.player.pos.x -= frames;
self.player.sprite.animate(&self.assets);
}
Direction::Left if self.player.pos.x > width => {
self.player.pos.x -= frames;
self.player.sprite.animate(&self.assets);
}

Direction::Right => {
if self.player.pos.x < WIDTH - width * 2 {
self.player.pos.x += frames;
self.player.sprite.animate(&self.assets);
}
Direction::Right if self.player.pos.x < WIDTH - width * 2 => {
self.player.pos.x += frames;
self.player.sprite.animate(&self.assets);
}
_ => (),
}
Expand Down
14 changes: 6 additions & 8 deletions examples/invaders/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#![forbid(unsafe_code)]

use error_iter::ErrorIter as _;
use game_loop::{game_loop, Time, TimeTrait as _};
use game_loop::{Time, TimeTrait as _, game_loop};
use gilrs::{Button, GamepadId, Gilrs};
use log::{debug, error};
use pixels::{Error, Pixels, SurfaceTexture};
use simple_invaders::{Controls, Direction, World, FPS, HEIGHT, TIME_STEP, WIDTH};
use simple_invaders::{Controls, Direction, FPS, HEIGHT, TIME_STEP, WIDTH, World};
use std::sync::Arc;
use std::{env, time::Duration};
use winit::{
Expand Down Expand Up @@ -175,9 +175,9 @@ fn main() -> Result<(), Error> {
Event::DeviceEvent { event, .. } => {
g.game.input.process_device_event(event);
}
Event::WindowEvent { event, .. } => {
Event::WindowEvent { event, .. }
// Let winit_input_helper collect events to build its state.
if g.game.input.process_window_event(event) {
if g.game.input.process_window_event(event) => {
// Update controls
g.game.update_controls();

Expand All @@ -195,15 +195,13 @@ fn main() -> Result<(), Error> {
}

// Resize the window
if let Some(size) = g.game.input.window_resized() {
if let Err(err) = g.game.pixels.resize_surface(size.width, size.height)
if let Some(size) = g.game.input.window_resized()
&& let Err(err) = g.game.pixels.resize_surface(size.width, size.height)
{
log_error("pixels.resize_surface", err);
g.exit();
}
}
}
}
_ => {}
}
},
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal-egui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "minimal-egui"
version = "0.1.0"
authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2021"
edition = "2024"
publish = false

[features]
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal-egui/src/gui.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use egui::{ClippedPrimitive, Context, TexturesDelta, ViewportId};
use egui_wgpu::{Renderer, RendererOptions, ScreenDescriptor};
use pixels::{wgpu, PixelsContext};
use pixels::{PixelsContext, wgpu};
use winit::{event_loop::ActiveEventLoop, window::Window};

/// Manages all state required for rendering egui over `Pixels`.
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal-fltk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "minimal-fltk"
version = "0.1.0"
authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2021"
edition = "2024"
publish = false

[features]
Expand Down
10 changes: 5 additions & 5 deletions examples/minimal-fltk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ fn main() -> Result<(), Error> {
world.update();

// Resize the window
if let Some((width, height)) = surface_size.borrow_mut().take() {
if let Err(err) = pixels.resize_surface(width, height) {
log_error("pixels.resize_surface", err);
app.quit();
}
if let Some((width, height)) = surface_size.borrow_mut().take()
&& let Err(err) = pixels.resize_surface(width, height)
{
log_error("pixels.resize_surface", err);
app.quit();
}

// Draw the current frame
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal-tao/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "minimal-tao"
version = "0.1.0"
authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2021"
edition = "2024"
publish = false

[features]
Expand Down
8 changes: 4 additions & 4 deletions examples/minimal-tao/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ fn main() -> Result<(), Error> {

_ => {
// Handle menu events
if let Ok(event) = MenuEvent::receiver().try_recv() {
if event.id.0 == "quit" {
*control_flow = ControlFlow::Exit;
}
if let Ok(event) = MenuEvent::receiver().try_recv()
&& event.id.0 == "quit"
{
*control_flow = ControlFlow::Exit;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal-web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "minimal-web"
version = "0.1.0"
authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2021"
edition = "2024"
publish = false

[features]
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal-winit-android/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "minimal-winit-android"
version = "0.1.0"
authors = ["Randommist <andreq11s@gmail.com>"]
edition = "2021"
edition = "2024"
publish = false

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal-winit-android/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl World {
}

#[cfg(target_os = "android")]
#[no_mangle]
#[unsafe(no_mangle)]
fn android_main(app: AndroidApp) {
use android_logger::Config;
use winit::event_loop::EventLoop;
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal-winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "minimal-winit"
version = "0.1.0"
authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2021"
edition = "2024"
publish = false

[features]
Expand Down
12 changes: 6 additions & 6 deletions examples/minimal-winit/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ fn main() -> Result<(), Error> {
}

// Resize the window
if let Some(size) = input.window_resized() {
if let Err(err) = pixels.resize_surface(size.width, size.height) {
log_error("pixels.resize_surface", err);
elwt.exit();
return;
}
if let Some(size) = input.window_resized()
&& let Err(err) = pixels.resize_surface(size.width, size.height)
{
log_error("pixels.resize_surface", err);
elwt.exit();
return;
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/raqote-winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "raqote-winit"
version = "0.1.0"
authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2021"
edition = "2024"
publish = false

[features]
Expand Down
12 changes: 6 additions & 6 deletions examples/raqote-winit/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ fn main() -> Result<(), Error> {
}

// Resize the window
if let Some(size) = input.window_resized() {
if let Err(err) = pixels.resize_surface(size.width, size.height) {
log_error("pixels.resize_surface", err);
elwt.exit();
return;
}
if let Some(size) = input.window_resized()
&& let Err(err) = pixels.resize_surface(size.width, size.height)
{
log_error("pixels.resize_surface", err);
elwt.exit();
return;
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/tiny-skia-winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "tiny-skia-winit"
version = "0.1.0"
authors = ["Jeffrey Rosenbluth <jeffrey.rosenbluth@gmail.com"]
edition = "2021"
edition = "2024"
publish = false

[features]
Expand Down
12 changes: 6 additions & 6 deletions examples/tiny-skia-winit/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ fn main() -> Result<(), Error> {
}

// Resize the window
if let Some(size) = input.window_resized() {
if let Err(err) = pixels.resize_surface(size.width, size.height) {
log_error("pixels.resize_surface", err);
elwt.exit();
return;
}
if let Some(size) = input.window_resized()
&& let Err(err) = pixels.resize_surface(size.width, size.height)
{
log_error("pixels.resize_surface", err);
elwt.exit();
return;
}
}

Expand Down
2 changes: 1 addition & 1 deletion internals/pixels-mocks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "pixels-mocks"
version = "0.1.0"
authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2021"
edition = "2024"
publish = false

[dependencies]
Expand Down
3 changes: 2 additions & 1 deletion run-wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[package]
name = "run-wasm"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false

[dependencies]
cargo-run-wasm = "0.3"
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#![deny(clippy::all)]
#![forbid(unsafe_code)]

pub use crate::builder::{check_texture_size, PixelsBuilder};
pub use crate::builder::{PixelsBuilder, check_texture_size};
pub use crate::renderers::ScalingRenderer;
pub use raw_window_handle;
use thiserror::Error;
Expand Down
Loading