parent
11c5961e4c
commit
9bfed17a7f
2
MSRV.md
2
MSRV.md
|
@ -12,6 +12,6 @@
|
||||||
|
|
||||||
## Policy
|
## Policy
|
||||||
|
|
||||||
The table above will be kept to up-to-date in lock-step with CI on the main branch in GitHub. It may contain information about unreleased and yanked versions. It is the user's responsibility to consult with the [`pixels` versions page](https://crates.io/crates/pixels/versions) on `crates.io` to verify version status.
|
The table above will be kept up-to-date in lock-step with CI on the main branch in GitHub. It may contain information about unreleased and yanked versions. It is the user's responsibility to consult with the [`pixels` versions page](https://crates.io/crates/pixels/versions) on `crates.io` to verify version status.
|
||||||
|
|
||||||
The MSRV will be chosen as the minimum version of `rustc` that can successfully pass CI, including documentation, lints, and all examples. For this reason, the minimum version _supported_ may be higher than the minimum version _required_ to compile the `pixels` crate itself.
|
The MSRV will be chosen as the minimum version of `rustc` that can successfully pass CI, including documentation, lints, and all examples. For this reason, the minimum version _supported_ may be higher than the minimum version _required_ to compile the `pixels` crate itself.
|
||||||
|
|
|
@ -287,10 +287,8 @@ impl World {
|
||||||
|
|
||||||
// Draw the invaders
|
// Draw the invaders
|
||||||
for row in &self.invaders.grid {
|
for row in &self.invaders.grid {
|
||||||
for col in row {
|
for invader in row.iter().flatten() {
|
||||||
if let Some(invader) = col {
|
blit(screen, &invader.pos, &invader.sprite);
|
||||||
blit(screen, &invader.pos, &invader.sprite);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#![deny(clippy::all)]
|
#![deny(clippy::all)]
|
||||||
|
|
||||||
pub struct RWH;
|
pub struct Rwh;
|
||||||
|
|
||||||
unsafe impl raw_window_handle::HasRawWindowHandle for RWH {
|
unsafe impl raw_window_handle::HasRawWindowHandle for Rwh {
|
||||||
fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle {
|
fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle {
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
return raw_window_handle::RawWindowHandle::MacOS(
|
return raw_window_handle::RawWindowHandle::MacOS(
|
||||||
|
|
|
@ -11,7 +11,7 @@ pub struct PixelsBuilder<'req, 'dev, 'win, W: HasRawWindowHandle> {
|
||||||
backend: wgpu::BackendBit,
|
backend: wgpu::BackendBit,
|
||||||
width: u32,
|
width: u32,
|
||||||
height: u32,
|
height: u32,
|
||||||
pixel_aspect_ratio: f64,
|
_pixel_aspect_ratio: f64,
|
||||||
present_mode: wgpu::PresentMode,
|
present_mode: wgpu::PresentMode,
|
||||||
surface_texture: SurfaceTexture<'win, W>,
|
surface_texture: SurfaceTexture<'win, W>,
|
||||||
texture_format: wgpu::TextureFormat,
|
texture_format: wgpu::TextureFormat,
|
||||||
|
@ -25,7 +25,7 @@ impl<'req, 'dev, 'win, W: HasRawWindowHandle> PixelsBuilder<'req, 'dev, 'win, W>
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// # use pixels::PixelsBuilder;
|
/// # use pixels::PixelsBuilder;
|
||||||
/// # let window = pixels_mocks::RWH;
|
/// # let window = pixels_mocks::Rwh;
|
||||||
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
|
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
|
||||||
/// let mut pixels = PixelsBuilder::new(256, 240, surface_texture)
|
/// let mut pixels = PixelsBuilder::new(256, 240, surface_texture)
|
||||||
/// .request_adapter_options(wgpu::RequestAdapterOptions {
|
/// .request_adapter_options(wgpu::RequestAdapterOptions {
|
||||||
|
@ -54,7 +54,7 @@ impl<'req, 'dev, 'win, W: HasRawWindowHandle> PixelsBuilder<'req, 'dev, 'win, W>
|
||||||
backend: wgpu::BackendBit::PRIMARY,
|
backend: wgpu::BackendBit::PRIMARY,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
pixel_aspect_ratio: 1.0,
|
_pixel_aspect_ratio: 1.0,
|
||||||
present_mode: wgpu::PresentMode::Fifo,
|
present_mode: wgpu::PresentMode::Fifo,
|
||||||
surface_texture,
|
surface_texture,
|
||||||
texture_format: wgpu::TextureFormat::Rgba8UnormSrgb,
|
texture_format: wgpu::TextureFormat::Rgba8UnormSrgb,
|
||||||
|
@ -110,7 +110,7 @@ impl<'req, 'dev, 'win, W: HasRawWindowHandle> PixelsBuilder<'req, 'dev, 'win, W>
|
||||||
) -> PixelsBuilder<'req, 'dev, 'win, W> {
|
) -> PixelsBuilder<'req, 'dev, 'win, W> {
|
||||||
assert!(pixel_aspect_ratio > 0.0);
|
assert!(pixel_aspect_ratio > 0.0);
|
||||||
|
|
||||||
self.pixel_aspect_ratio = pixel_aspect_ratio;
|
self._pixel_aspect_ratio = pixel_aspect_ratio;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -170,7 +170,7 @@ impl Pixels {
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// # use pixels::Pixels;
|
/// # use pixels::Pixels;
|
||||||
/// # let window = pixels_mocks::RWH;
|
/// # let window = pixels_mocks::Rwh;
|
||||||
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
|
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
|
||||||
/// let mut pixels = Pixels::new(320, 240, surface_texture)?;
|
/// let mut pixels = Pixels::new(320, 240, surface_texture)?;
|
||||||
/// # Ok::<(), pixels::Error>(())
|
/// # Ok::<(), pixels::Error>(())
|
||||||
|
@ -272,7 +272,7 @@ impl Pixels {
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// # use pixels::Pixels;
|
/// # use pixels::Pixels;
|
||||||
/// # let window = pixels_mocks::RWH;
|
/// # let window = pixels_mocks::Rwh;
|
||||||
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
|
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
|
||||||
/// let mut pixels = Pixels::new(320, 240, surface_texture)?;
|
/// let mut pixels = Pixels::new(320, 240, surface_texture)?;
|
||||||
///
|
///
|
||||||
|
@ -310,7 +310,7 @@ impl Pixels {
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// # use pixels::Pixels;
|
/// # use pixels::Pixels;
|
||||||
/// # let window = pixels_mocks::RWH;
|
/// # let window = pixels_mocks::Rwh;
|
||||||
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
|
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
|
||||||
/// let mut pixels = Pixels::new(320, 240, surface_texture)?;
|
/// let mut pixels = Pixels::new(320, 240, surface_texture)?;
|
||||||
///
|
///
|
||||||
|
@ -411,7 +411,7 @@ impl Pixels {
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// # use pixels::Pixels;
|
/// # use pixels::Pixels;
|
||||||
/// # let window = pixels_mocks::RWH;
|
/// # let window = pixels_mocks::Rwh;
|
||||||
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
|
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
|
||||||
/// const WIDTH: u32 = 320;
|
/// const WIDTH: u32 = 320;
|
||||||
/// const HEIGHT: u32 = 240;
|
/// const HEIGHT: u32 = 240;
|
||||||
|
@ -471,7 +471,7 @@ impl Pixels {
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// # use pixels::Pixels;
|
/// # use pixels::Pixels;
|
||||||
/// # let window = pixels_mocks::RWH;
|
/// # let window = pixels_mocks::Rwh;
|
||||||
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
|
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
|
||||||
/// const WIDTH: u32 = 320;
|
/// const WIDTH: u32 = 320;
|
||||||
/// const HEIGHT: u32 = 240;
|
/// const HEIGHT: u32 = 240;
|
||||||
|
|
Loading…
Reference in a new issue