From 75bfbf4cef9c1ba2f1e7cdc2f3a2175962d0980d Mon Sep 17 00:00:00 2001 From: Imbris Date: Sat, 11 May 2019 10:59:48 -0400 Subject: [PATCH] fix & remove some unused uses, cursor toggle tweak Former-commit-id: b398b11606d983b7f80364a5689804e3491c218f --- voxygen/src/hud/mod.rs | 14 +++++++------- voxygen/src/menu/char_selection/ui.rs | 13 +++++++------ voxygen/src/menu/main/ui.rs | 9 +++++---- voxygen/src/ui/img_ids.rs | 2 +- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 83bf5d1079..9a9ce47aca 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -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 { diff --git a/voxygen/src/menu/char_selection/ui.rs b/voxygen/src/menu/char_selection/ui.rs index 10f1591648..469e3a84ea 100644 --- a/voxygen/src/menu/char_selection/ui.rs +++ b/voxygen/src/menu/char_selection/ui.rs @@ -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, }; diff --git a/voxygen/src/menu/main/ui.rs b/voxygen/src/menu/main/ui.rs index c8f4f078b2..431b3673cf 100644 --- a/voxygen/src/menu/main/ui.rs +++ b/voxygen/src/menu/main/ui.rs @@ -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, }; diff --git a/voxygen/src/ui/img_ids.rs b/voxygen/src/ui/img_ids.rs index 4107d4e990..133dafb689 100644 --- a/voxygen/src/ui/img_ids.rs +++ b/voxygen/src/ui/img_ids.rs @@ -87,7 +87,7 @@ macro_rules! image_ids { pub fn load(ui: &mut crate::ui::Ui) -> Result { 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)?), )*)* }) } }