diff --git a/src/lib.rs b/src/lib.rs index cec30a5..35c5ff5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,7 +52,7 @@ pub use world::{Camera, Entity, World}; /// Window API and input events pub mod window; -pub use window::event::{Button as ButtonEvent, Event}; +pub use window::event::{Button as ButtonEvent, Event, Modifiers, MouseScroll}; pub use window::{Input, ReadInput, Window}; //pub use utils::{ Id }; diff --git a/src/tasks/scheduler.rs b/src/tasks/scheduler.rs index 1c72b98..c0ad589 100644 --- a/src/tasks/scheduler.rs +++ b/src/tasks/scheduler.rs @@ -145,7 +145,7 @@ pub fn spawn( } if restart_queue { - log::debug!("restart queue(queue_executed: {}", queue_executed); + // log::debug!("restart queue(queue_executed: {}", queue_executed); if queue_executed { let mut ctx = context_manager.lock().expect("Mutex to be locked"); ctx.reset_data(tasks_graph_changed); @@ -155,24 +155,24 @@ pub fn spawn( let default_state = TypeId::of::<()>(); let current_state = ctx.current_state(); - log::debug!("current state: {:?}", current_state); + // log::debug!("current state: {:?}", current_state); if current_state != default_state { if let Some(tasks) = pool.select_for_state(&default_state) { for task in tasks.iter() { - log::debug!( - "tasks for default state: {:?}", - pool.get(*task).and_then(|t| t.name()) - ); + // log::debug!( + // "tasks for default state: {:?}", + // pool.get(*task).and_then(|t| t.name()) + // ); } queue.extend_from_slice(tasks); } } if let Some(tasks) = pool.select_for_state(¤t_state) { for task in tasks.iter() { - log::debug!( - "tasks for current state: {:?}", - pool.get(*task).and_then(|t| t.name()) - ); + // log::debug!( + // "tasks for current state: {:?}", + // pool.get(*task).and_then(|t| t.name()) + // ); } queue.extend_from_slice(tasks); } @@ -198,28 +198,28 @@ pub fn spawn( while index < stop_index { let task_id = queue[index]; if let Some(mut task) = pool.take(&task_id) { - log::debug!("task({}): begin control", task.name()); + // log::debug!("task({}): begin control", task.name()); if !task.is_scheduled() { - log::debug!("task({}): not scheduled yet", task.name()); + // log::debug!("task({}): not scheduled yet", task.name()); if task.name() == "dotrix::window::input::ReadInput" { - log::debug!( - "task({}): not scheduled yet: {:?}", - task.name(), - task.dependencies() - ); + // log::debug!( + // "task({}): not scheduled yet: {:?}", + // task.name(), + // task.dependencies() + // ); } if let Some(dependencies_state) = context_manager .lock() .unwrap() .match_dependencies(task.dependencies()) { - log::debug!("task({}): to be scheduled", task.name()); + // log::debug!("task({}): to be scheduled", task.name()); task.schedule_with(dependencies_state); } else { - log::debug!( - "task({}): dependencies are not sattisfied", - task.name() - ); + // log::debug!( + // "task({}): dependencies are not sattisfied", + // task.name() + // ); } } diff --git a/src/window.rs b/src/window.rs index 363a51d..ce0e99d 100644 --- a/src/window.rs +++ b/src/window.rs @@ -224,17 +224,21 @@ impl winit::application::ApplicationHandler for EventLoop { self.task_manager.provide(input_event); } winit::event::WindowEvent::MouseWheel { delta, .. } => { - let input_event = match delta { - winit::event::MouseScrollDelta::LineDelta(x, y) => event::MouseScroll::Lines { - horizontal: x, - vertical: y, - }, - winit::event::MouseScrollDelta::PixelDelta(position) => { - event::MouseScroll::Pixels { - horizontal: position.x, - vertical: position.y, + let input_event = event::Event::MouseScroll { + delta: match delta { + winit::event::MouseScrollDelta::LineDelta(x, y) => { + event::MouseScroll::Lines { + horizontal: x, + vertical: y, + } } - } + winit::event::MouseScrollDelta::PixelDelta(position) => { + event::MouseScroll::Pixels { + horizontal: position.x, + vertical: position.y, + } + } + }, }; self.task_manager.provide(input_event); } @@ -255,11 +259,11 @@ impl winit::application::ApplicationHandler for EventLoop { if let Some(instance) = self.window_instance.as_ref() { instance.winit_window.pre_present_notify(); } - log::debug!("Wait for presenter..."); + // log::debug!("Wait for presenter..."); self.task_manager .wait_for::() .present(); - log::debug!("...presented"); + // log::debug!("...presented"); self.task_manager.run(); // Note: can be used for debug // fill::fill_window(window); diff --git a/src/world/camera.rs b/src/world/camera.rs index d280bee..5f867b4 100644 --- a/src/world/camera.rs +++ b/src/world/camera.rs @@ -94,7 +94,7 @@ impl View { /// Return view matrix made from target pub fn target(&self, target: Vec3) -> Mat4 { - self.target_up(target, Vec3::Z) + self.target_up(target, -Vec3::Y) } /// Return view matrix made from target and up vector