diff --git a/iris/Cargo.lock b/iris/Cargo.lock index 0796ff1..78e9db3 100644 --- a/iris/Cargo.lock +++ b/iris/Cargo.lock @@ -1070,7 +1070,6 @@ dependencies = [ "fxhash", "image", "wgpu", - "winit", ] [[package]] diff --git a/iris/core/Cargo.toml b/iris/core/Cargo.toml index a85a26d..71edca5 100644 --- a/iris/core/Cargo.toml +++ b/iris/core/Cargo.toml @@ -4,7 +4,6 @@ version.workspace = true edition.workspace = true [dependencies] -winit = { workspace = true } wgpu = { workspace = true } bytemuck ={ workspace = true } image = { workspace = true } diff --git a/iris/core/src/render/mod.rs b/iris/core/src/render/mod.rs index 1695efa..0489ab5 100644 --- a/iris/core/src/render/mod.rs +++ b/iris/core/src/render/mod.rs @@ -3,14 +3,13 @@ use std::num::NonZero; use crate::{ UiData, UiRenderState, render::{data::PrimitiveInstance, texture::GpuTextures, util::ArrBuf}, - util::HashMap, + util::{HashMap, Vec2}, }; use data::WindowUniform; use wgpu::{ util::{BufferInitDescriptor, DeviceExt}, *, }; -use winit::dpi::PhysicalSize; mod data; mod primitive; @@ -118,10 +117,15 @@ impl UiRenderNode { } } - pub fn resize(&mut self, size: &PhysicalSize, queue: &Queue) { + /// Takes a size rather than a window type: this is the only thing the + /// core wanted from winit, and depending on a windowing backend for two + /// numbers is what put `android-activity` in the core's graph for an + /// Android build that is meant to go through android-view instead. + pub fn resize(&mut self, size: impl Into, queue: &Queue) { + let size = size.into(); let slice = &[WindowUniform { - width: size.width as f32, - height: size.height as f32, + width: size.x, + height: size.y, }]; queue.write_buffer(&self.window_buffer, 0, bytemuck::cast_slice(slice)); } diff --git a/iris/src/default/render.rs b/iris/src/default/render.rs index 625a9fa..970d44c 100644 --- a/iris/src/default/render.rs +++ b/iris/src/default/render.rs @@ -52,7 +52,7 @@ impl UiRenderer { self.config.width = size.width; self.config.height = size.height; self.surface.configure(&self.device, &self.config); - self.ui.resize(size, &self.queue); + self.ui.resize((size.width, size.height), &self.queue); } fn create_encoder(device: &Device) -> CommandEncoder {