mirror of https://github.com/Leinnan/doppler.git
Mouse scroll
This commit is contained in:
parent
6ab1057199
commit
e17f957009
|
|
@ -6,14 +6,9 @@ use crate::gaia::consts;
|
|||
use crate::gaia::engine::Engine;
|
||||
use crate::gaia::light::*;
|
||||
use crate::gaia::sky::Sky;
|
||||
use crate::gaia::*;
|
||||
use cgmath::prelude::*;
|
||||
use cgmath::{perspective, vec3, Deg, Matrix4, Point3, Vector3};
|
||||
#[cfg(feature = "glfw_obsolete")]
|
||||
use glfw;
|
||||
use glutin::event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent};
|
||||
#[cfg(feature = "glfw_obsolete")]
|
||||
use imgui_glfw_rs::glfw;
|
||||
use cgmath::{perspective, vec3, Deg, Matrix4, Point3};
|
||||
use glutin::event::{ElementState, VirtualKeyCode};
|
||||
|
||||
pub struct ExampleClient {
|
||||
models: Vec<ModelComponent>,
|
||||
|
|
@ -152,7 +147,6 @@ impl Client for ExampleClient {
|
|||
}
|
||||
fn update(&mut self, _engine: &Engine, delta: f32) {
|
||||
self.delta = delta;
|
||||
println!("{}", delta);
|
||||
}
|
||||
|
||||
#[cfg(feature = "imgui_inspect")]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ pub trait Client {
|
|||
fn on_keyboard(&mut self, code: &VirtualKeyCode, state: &ElementState);
|
||||
fn on_mouse_scroll(&mut self, yoffset: f32);
|
||||
fn on_mouse_move(&mut self, x: f32, y: f32);
|
||||
// fn draw<T>(&mut self, engine: &mut Engine<T>) where T: Client;
|
||||
unsafe fn draw(&mut self);
|
||||
#[cfg(feature = "imgui_inspect")]
|
||||
fn debug_draw(&mut self, ui: &imgui::Ui);
|
||||
|
|
|
|||
|
|
@ -187,7 +187,6 @@ impl Engine {
|
|||
let mut screensize = self.size;
|
||||
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
use glutin::event::{Event, WindowEvent};
|
||||
use glutin::event_loop::ControlFlow;
|
||||
*control_flow = ControlFlow::Poll;
|
||||
platform.handle_event(imgui.io_mut(), &gl_window.window(), &event);
|
||||
|
|
@ -207,6 +206,13 @@ impl Engine {
|
|||
}
|
||||
Event::LoopDestroyed => return,
|
||||
Event::WindowEvent { event, .. } => match event {
|
||||
WindowEvent::MouseWheel { delta, .. } => {
|
||||
use glutin::event::MouseScrollDelta;
|
||||
match delta {
|
||||
MouseScrollDelta::LineDelta(x, y) => client.on_mouse_scroll(y),
|
||||
MouseScrollDelta::PixelDelta(pos) => client.on_mouse_scroll(pos.y as f32),
|
||||
}
|
||||
}
|
||||
WindowEvent::CursorMoved { position, .. } => {
|
||||
let xpos = position.x as f32;
|
||||
let ypos = position.y as f32;
|
||||
|
|
|
|||
Loading…
Reference in New Issue