Remove egui mapping
@@ -125,7 +125,7 @@ impl GUI {
}
fn construct_egui_input(frame_input: &FrameInput) -> egui::RawInput {
- let mut egui_modifiers = egui::Modifiers::default();
+ let mut egui_modifiers = egui::Modifiers::default(); //TODO
let events = frame_input
.events
.iter()
@@ -246,3 +246,85 @@ fn construct_egui_input(frame_input: &FrameInput) -> egui::RawInput {
..Default::default()
}
}
+
+impl From<&Key> for egui::Key {
+ fn from(key: &Key) -> Self {
+ use crate::control::Key::*;
+ use egui::Key;
+ match key {
+ ArrowDown => Key::ArrowDown,
+ ArrowLeft => Key::ArrowLeft,
+ ArrowRight => Key::ArrowRight,
+ ArrowUp => Key::ArrowUp,
+ Escape => Key::Escape,
+ Tab => Key::Tab,
+ Backspace => Key::Backspace,
+ Enter => Key::Enter,
+ Space => Key::Space,
+ Insert => Key::Insert,
+ Delete => Key::Delete,
+ Home => Key::Home,
+ End => Key::End,
+ PageUp => Key::PageUp,
+ PageDown => Key::PageDown,
+ Num0 => Key::Num0,
+ Num1 => Key::Num1,
+ Num2 => Key::Num2,
+ Num3 => Key::Num3,
+ Num4 => Key::Num4,
+ Num5 => Key::Num5,
+ Num6 => Key::Num6,
+ Num7 => Key::Num7,
+ Num8 => Key::Num8,
+ Num9 => Key::Num9,
+ A => Key::A,
+ B => Key::B,
+ C => Key::C,
+ D => Key::D,
+ E => Key::E,
+ F => Key::F,
+ G => Key::G,
+ H => Key::H,
+ I => Key::I,
+ J => Key::J,
+ K => Key::K,
+ L => Key::L,
+ M => Key::M,
+ N => Key::N,
+ O => Key::O,
+ P => Key::P,
+ Q => Key::Q,
+ R => Key::R,
+ S => Key::S,
+ T => Key::T,
+ U => Key::U,
+ V => Key::V,
+ W => Key::W,
+ X => Key::X,
+ Y => Key::Y,
+ Z => Key::Z,
+ }
+ }
+}
+
+impl From<&Modifiers> for egui::Modifiers {
+ fn from(modifiers: &Modifiers) -> Self {
+ Self {
+ alt: modifiers.alt,
+ ctrl: modifiers.ctrl,
+ shift: modifiers.shift,
+ command: modifiers.command,
+ mac_cmd: cfg!(target_os = "macos") && modifiers.command,
+ }
+ }
+}
+
+impl From<&MouseButton> for egui::PointerButton {
+ fn from(button: &MouseButton) -> Self {
+ match button {
+ MouseButton::Left => egui::PointerButton::Primary,
+ MouseButton::Right => egui::PointerButton::Secondary,
+ MouseButton::Middle => egui::PointerButton::Middle,
+ }
+ }
+}
