From 296a1d754e653f5b9e927c4114d9f6f6ba03dec5 Mon Sep 17 00:00:00 2001 From: IsseW Date: Tue, 26 Oct 2021 00:42:30 +0200 Subject: [PATCH] consider key layout --- voxygen/src/menu/main/ui/connecting.rs | 4 +++- voxygen/src/menu/main/ui/mod.rs | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/voxygen/src/menu/main/ui/connecting.rs b/voxygen/src/menu/main/ui/connecting.rs index 33cbcc5758..a87a3bbeb8 100644 --- a/voxygen/src/menu/main/ui/connecting.rs +++ b/voxygen/src/menu/main/ui/connecting.rs @@ -14,6 +14,7 @@ use crate::{ use common::assets::{self, AssetExt}; use i18n::Localization; use iced::{button, Align, Column, Container, Length, Row, Space, Text}; +use keyboard_keynames::key_layout::KeyLayout; use serde::{Deserialize, Serialize}; struct LoadingAnimation { @@ -91,6 +92,7 @@ impl Screen { button_style: style::button::Style, show_tip: bool, controls: &ControlSettings, + key_layout: &Option, ) -> Element { // TODO: add built in support for animated images let frame_index = (time * self.loading_animation.speed_factor as f64) @@ -116,7 +118,7 @@ impl Screen { new_tip.push_str(&tip[last_index..start]); new_tip.push_str( controls.keybindings[&game_input] - .display_string(&None) + .display_string(key_layout) .as_str(), ); last_index = end + 1; diff --git a/voxygen/src/menu/main/ui/mod.rs b/voxygen/src/menu/main/ui/mod.rs index 38354b71c7..13da25be86 100644 --- a/voxygen/src/menu/main/ui/mod.rs +++ b/voxygen/src/menu/main/ui/mod.rs @@ -19,6 +19,7 @@ use crate::{ }; use i18n::{LanguageMetadata, LocalizationHandle}; use iced::{text_input, Column, Container, HorizontalAlignment, Length, Row, Space}; +use keyboard_keynames::key_layout::KeyLayout; //ImageFrame, Tooltip, use crate::settings::Settings; use common::assets::{self, AssetExt}; @@ -229,7 +230,7 @@ impl Controls { } } - fn view(&mut self, settings: &Settings, dt: f32) -> Element { + fn view(&mut self, settings: &Settings, key_layout: &Option, dt: f32) -> Element { self.time += dt as f64; // TODO: consider setting this as the default in the renderer @@ -309,6 +310,7 @@ impl Controls { button_style, settings.interface.loading_tips, &settings.controls, + key_layout, ), }; @@ -588,7 +590,7 @@ impl MainMenuUi { let mut events = Vec::new(); let (messages, _) = self.ui.maintain( - self.controls.view(&global_state.settings, dt.as_secs_f32()), + self.controls.view(&global_state.settings, &global_state.window.key_layout, dt.as_secs_f32()), global_state.window.renderer_mut(), None, &mut global_state.clipboard,