mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fix & remove some unused uses, cursor toggle tweak
Former-commit-id: b398b11606d983b7f80364a5689804e3491c218f
This commit is contained in:
parent
aed6750885
commit
1948bc6392
@ -475,6 +475,13 @@ impl Hud {
|
||||
self.show.toggle_ui();
|
||||
true
|
||||
}
|
||||
WinEvent::KeyDown(Key::ToggleCursor) => {
|
||||
self.force_ungrab = !self.force_ungrab;
|
||||
if self.force_ungrab {
|
||||
global_state.window.grab_cursor(false);
|
||||
}
|
||||
true
|
||||
}
|
||||
_ if !self.show.ui => false,
|
||||
WinEvent::Zoom(_) => !cursor_grabbed && !self.ui.no_widget_capturing_mouse(),
|
||||
WinEvent::KeyDown(Key::Enter) => {
|
||||
@ -527,13 +534,6 @@ impl Hud {
|
||||
self.show.toggle_help();
|
||||
true
|
||||
}
|
||||
Key::ToggleCursor => {
|
||||
self.force_ungrab = !self.force_ungrab;
|
||||
if self.force_ungrab {
|
||||
global_state.window.grab_cursor(false);
|
||||
}
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
},
|
||||
WinEvent::KeyDown(key) | WinEvent::KeyUp(key) => match key {
|
||||
|
@ -1,17 +1,18 @@
|
||||
use crate::{
|
||||
render::Renderer,
|
||||
ui::{self, BlankGraphic, Graphic, ImageGraphic, ScaleMode, Ui, VoxelGraphic},
|
||||
ui::{
|
||||
self,
|
||||
img_ids::{ImageGraphic, VoxelGraphic},
|
||||
ScaleMode, Ui,
|
||||
},
|
||||
window::Window,
|
||||
};
|
||||
use common::{
|
||||
assets,
|
||||
comp::character::{Belt, Character, Chest, Foot, Gender, Hand, Head, Pants, Race, Weapon},
|
||||
use common::comp::character::{
|
||||
Belt, Character, Chest, Foot, Gender, Hand, Head, Pants, Race, Weapon,
|
||||
};
|
||||
use conrod_core::{
|
||||
color,
|
||||
color::TRANSPARENT,
|
||||
image::Id as ImgId,
|
||||
text::font::Id as FontId,
|
||||
widget::{text_box::Event as TextBoxEvent, Button, Image, Rectangle, Text, TextBox},
|
||||
widget_ids, Borderable, Color, Colorable, Labelable, Positionable, Sizeable, Widget,
|
||||
};
|
||||
|
@ -1,15 +1,16 @@
|
||||
use crate::{
|
||||
render::Renderer,
|
||||
ui::{self, BlankGraphic, Graphic, ImageGraphic, ScaleMode, Ui, VoxelGraphic},
|
||||
ui::{
|
||||
self,
|
||||
img_ids::{ImageGraphic, VoxelGraphic},
|
||||
ScaleMode, Ui,
|
||||
},
|
||||
GlobalState, DEFAULT_PUBLIC_SERVER,
|
||||
};
|
||||
use common::assets;
|
||||
use conrod_core::{
|
||||
color,
|
||||
color::TRANSPARENT,
|
||||
image::Id as ImgId,
|
||||
position::Relative,
|
||||
text::font::Id as FontId,
|
||||
widget::{text_box::Event as TextBoxEvent, Button, Image, List, Rectangle, Text, TextBox},
|
||||
widget_ids, Borderable, Color, Colorable, Labelable, Positionable, Sizeable, Widget,
|
||||
};
|
||||
|
@ -87,7 +87,7 @@ macro_rules! image_ids {
|
||||
pub fn load(ui: &mut crate::ui::Ui) -> Result<Self, common::assets::Error> {
|
||||
use crate::ui::img_ids::GraphicCreator;
|
||||
Ok(Self {
|
||||
$($( $name: ui.add_graphic(<$T>::new_graphic($specifier)?), )*)*
|
||||
$($( $name: ui.add_graphic(<$T as GraphicCreator>::new_graphic($specifier)?), )*)*
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user