diff --git a/driver/src/lib.rs b/driver/src/lib.rs index a380f27..63d71c8 100644 --- a/driver/src/lib.rs +++ b/driver/src/lib.rs @@ -33,7 +33,6 @@ pub struct State { pub x: i32, pub y: i32, pub buttons: Buttons, - pub previous_buttons: Buttons, } #[derive(Debug, Clone, Copy, Default)] @@ -120,7 +119,6 @@ impl G13 { pub fn read(&self) -> Result> { let mut state = self.state(); - state.previous_buttons = state.buttons; let mut reader = self.interface.endpoint::(0x81)?.reader(8); let mut buf = [0; 8]; reader.read_exact(&mut buf)?; diff --git a/mini-game/src/main.rs b/mini-game/src/main.rs index 23438aa..92928f6 100644 --- a/mini-game/src/main.rs +++ b/mini-game/src/main.rs @@ -1,4 +1,4 @@ -use std::f32::consts::TAU; +use std::f32::consts::{PI, TAU}; use std::time::Duration; use bevy::app::ScheduleRunnerPlugin; @@ -12,7 +12,7 @@ use wgpu::{TextureFormat, TextureUsages}; mod post_process; use crate::post_process::PostProcessSettings; -use crate::renderer::{ImageExport, ImageExportPlugin, ImageExportSource}; +use crate::renderer::{G13Resource, ImageExport, ImageExportPlugin, ImageExportSource}; use crate::shared::Spinner; mod renderer; @@ -28,13 +28,13 @@ fn main() { }) .build() .disable::(), - ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(1. / 24.)), + ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(1. / 30.)), post_process::PostProcessPlugin, ImageExportPlugin, )) .insert_resource(ClearColor(Color::linear_rgba(0.0, 0.0, 0.0, 1.0))) .add_systems(Startup, setup_scene_system) - .add_systems(Update, rotate_cube) + .add_systems(Update, (rotate_cube)) .run(); } @@ -72,8 +72,27 @@ fn setup_scene_system( commands.spawn((ImageExport(export_sources.add(image_handle)),)); } -fn rotate_cube(mut cubes: Query<(&mut Transform, &Spinner)>, timer: Res