fix & remove some unused uses, cursor toggle tweak

Former-commit-id: b398b11606d983b7f80364a5689804e3491c218f
This commit is contained in:
Imbris 2019-05-11 10:59:48 -04:00
parent aed6750885
commit 1948bc6392
4 changed files with 20 additions and 18 deletions

View File

@ -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 {

View File

@ -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,
};

View File

@ -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,
};

View File

@ -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)?), )*)*
})
}
}