mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-25 08:18:43 -06:00
weird camera
This commit is contained in:
parent
3fb2194ca6
commit
a10b59880a
20
src/game.rs
20
src/game.rs
|
@ -57,12 +57,21 @@ pub fn run() {
|
||||||
event_loop.run(move |event, _, control_flow| {
|
event_loop.run(move |event, _, control_flow| {
|
||||||
*control_flow = ControlFlow::Poll;
|
*control_flow = ControlFlow::Poll;
|
||||||
match event {
|
match event {
|
||||||
Event::MainEventsCleared => (),
|
// Mouse motion
|
||||||
Event::DeviceEvent {
|
Event::DeviceEvent {
|
||||||
event: DeviceEvent::MouseMotion{ delta, }, ..
|
event: DeviceEvent::MouseMotion{ delta, }, ..
|
||||||
} => {
|
} => {
|
||||||
state.controls.process_mouse_input(delta.0, delta.1);
|
state.controls.process_mouse_input(delta.0, delta.1);
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
// Keyboard input
|
||||||
|
Event::DeviceEvent { event: DeviceEvent::Key(input), .. } => {
|
||||||
|
if let Some(key) = input.virtual_keycode {
|
||||||
|
state.controls.process_keyboard_input(key, input.state);
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Window events
|
||||||
Event::WindowEvent { event, .. } => {
|
Event::WindowEvent { event, .. } => {
|
||||||
match event {
|
match event {
|
||||||
WindowEvent::CloseRequested => {
|
WindowEvent::CloseRequested => {
|
||||||
|
@ -70,17 +79,10 @@ pub fn run() {
|
||||||
*control_flow = ControlFlow::Exit;
|
*control_flow = ControlFlow::Exit;
|
||||||
return
|
return
|
||||||
},
|
},
|
||||||
WindowEvent::KeyboardInput {
|
|
||||||
input: KeyboardInput {
|
|
||||||
virtual_keycode: Some(key),
|
|
||||||
state: el_state, ..
|
|
||||||
}, ..
|
|
||||||
} => {
|
|
||||||
state.controls.process_keyboard_input(key, el_state);
|
|
||||||
},
|
|
||||||
_ => return
|
_ => return
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Event::MainEventsCleared => (),
|
||||||
_ => return
|
_ => return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue