mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix mistake with event processing
This commit is contained in:
parent
83c397f7be
commit
1d632c6e62
@ -1,7 +1,7 @@
|
|||||||
use conrod_core::{event::Input, input::Button};
|
use conrod_core::{event::Input, input::Button};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Event(pub Input);
|
pub struct Event(pub Input);
|
||||||
impl Event {
|
impl Event {
|
||||||
pub fn try_from(
|
pub fn try_from(
|
||||||
|
@ -241,7 +241,7 @@ pub enum AnalogGameInput {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Represents an incoming event from the window.
|
/// Represents an incoming event from the window.
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum Event {
|
pub enum Event {
|
||||||
/// The window has been requested to close.
|
/// The window has been requested to close.
|
||||||
Close,
|
Close,
|
||||||
@ -610,9 +610,7 @@ impl Window {
|
|||||||
|
|
||||||
#[allow(clippy::match_bool)] // TODO: Pending review in #587
|
#[allow(clippy::match_bool)] // TODO: Pending review in #587
|
||||||
pub fn fetch_events(&mut self) -> Vec<Event> {
|
pub fn fetch_events(&mut self) -> Vec<Event> {
|
||||||
let mut events = std::mem::take(&mut self.events);
|
self.events.append(&mut self.supplement_events);
|
||||||
|
|
||||||
events.append(&mut self.supplement_events);
|
|
||||||
|
|
||||||
// Refresh ui size (used when changing playstates)
|
// Refresh ui size (used when changing playstates)
|
||||||
if self.needs_refresh_resize {
|
if self.needs_refresh_resize {
|
||||||
@ -622,9 +620,9 @@ impl Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Receive any messages sent through the message channel
|
// Receive any messages sent through the message channel
|
||||||
self.message_receiver
|
for message in self.message_receiver.try_iter() {
|
||||||
.try_iter()
|
self.events.push(Event::ScreenshotMessage(message))
|
||||||
.for_each(|message| events.push(Event::ScreenshotMessage(message)));
|
}
|
||||||
|
|
||||||
if let Some(gilrs) = &mut self.gilrs {
|
if let Some(gilrs) = &mut self.gilrs {
|
||||||
while let Some(event) = gilrs.next_event() {
|
while let Some(event) = gilrs.next_event() {
|
||||||
@ -779,7 +777,7 @@ impl Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut events = std::mem::replace(&mut self.events, Vec::new());
|
let mut events = std::mem::take(&mut self.events);
|
||||||
// Mouse emulation for the menus, to be removed when a proper menu navigation
|
// Mouse emulation for the menus, to be removed when a proper menu navigation
|
||||||
// system is available
|
// system is available
|
||||||
if !self.cursor_grabbed {
|
if !self.cursor_grabbed {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user