From 5e8716acf05525660a676ee22bac71c8f6c6abf8 Mon Sep 17 00:00:00 2001 From: Wynd Date: Fri, 8 Nov 2024 13:08:12 +0200 Subject: [PATCH] Some cleanup --- Cargo.toml | 6 ------ src/app.rs | 2 +- src/lib.rs | 11 +---------- src/spotlight.rs | 6 +----- 4 files changed, 3 insertions(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 662e1fd..eabcf57 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,12 +27,6 @@ cgmath = "0.18" [profile.dev] codegen-backend = "cranelift" -opt-level = 0 -lto = false -incremental = true [profile.release] -opt-level = 3 strip = true -lto = true -codegen-units = 1 diff --git a/src/app.rs b/src/app.rs index 46a46d8..1b959d8 100644 --- a/src/app.rs +++ b/src/app.rs @@ -59,9 +59,9 @@ impl<'a> ApplicationHandler for App<'a> { event_loop.exit(); } WindowEvent::RedrawRequested => { - state.window.request_redraw(); state.update(); state.render().unwrap(); + state.window.request_redraw(); } WindowEvent::Resized(new_size) => { state.resize(new_size); diff --git a/src/lib.rs b/src/lib.rs index 65eaf75..321e037 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,18 +11,9 @@ pub mod vertex; pub fn capture() -> anyhow::Result<()> { let event_loop = EventLoop::new()?; - event_loop.set_control_flow(ControlFlow::Wait); + event_loop.set_control_flow(ControlFlow::Poll); let mut app = App::default(); Ok(event_loop.run_app(&mut app)?) } - -pub fn ease_in_out_cubic(x: f32) -> f32 { - if x < 0.5 { - 4.0 * x * x * x - } - else { - 1.0 - (-2.0 * x + 2.0).powf(3.0) / 2.0 - } -} diff --git a/src/spotlight.rs b/src/spotlight.rs index 2f7c4e3..6465c5c 100644 --- a/src/spotlight.rs +++ b/src/spotlight.rs @@ -6,7 +6,7 @@ use winit::{ keyboard::{Key, NamedKey}, }; -use crate::{controller::CameraController, ease_in_out_cubic}; +use crate::controller::CameraController; const REFRESH_RATE: f32 = 1.0 / 60.0; @@ -14,12 +14,10 @@ pub struct Spotlight { window: Arc, cursor_position: (f32, f32), - accel: f32, size: f32, delta_size: f32, is_ctrl_pressed: bool, - scrolling: f32, } pub struct SpotlightInfo { @@ -35,12 +33,10 @@ impl Spotlight { window, cursor_position: (960.0, 540.0), - accel: 0.0, size: 50.0, delta_size: 0.0, is_ctrl_pressed: false, - scrolling: 0.0, }; let layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {