|
|
@ -76,7 +76,7 @@ pub fn ui_loop() {
|
|
|
|
let mut skulpin_renderer = RendererBuilder::new()
|
|
|
|
let mut skulpin_renderer = RendererBuilder::new()
|
|
|
|
.prefer_integrated_gpu()
|
|
|
|
.prefer_integrated_gpu()
|
|
|
|
.use_vulkan_debug_layer(true)
|
|
|
|
.use_vulkan_debug_layer(true)
|
|
|
|
.present_mode_priority(vec![PresentMode::Mailbox, PresentMode::Immediate])
|
|
|
|
.present_mode_priority(vec![PresentMode::Immediate])
|
|
|
|
.coordinate_system(CoordinateSystem::Logical)
|
|
|
|
.coordinate_system(CoordinateSystem::Logical)
|
|
|
|
.build(&window)
|
|
|
|
.build(&window)
|
|
|
|
.expect("Failed to create renderer");
|
|
|
|
.expect("Failed to create renderer");
|
|
|
@ -100,6 +100,7 @@ pub fn ui_loop() {
|
|
|
|
window.set_title(&title).expect("Could not set title");
|
|
|
|
window.set_title(&title).expect("Could not set title");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mut ignore_text_input = false;
|
|
|
|
for event in event_pump.poll_iter() {
|
|
|
|
for event in event_pump.poll_iter() {
|
|
|
|
match event {
|
|
|
|
match event {
|
|
|
|
Event::Quit {..} => break 'running,
|
|
|
|
Event::Quit {..} => break 'running,
|
|
|
@ -107,6 +108,7 @@ pub fn ui_loop() {
|
|
|
|
Event::KeyDown { keycode: Some(keycode), keymod: modifiers, .. } => {
|
|
|
|
Event::KeyDown { keycode: Some(keycode), keymod: modifiers, .. } => {
|
|
|
|
if let Some((key_text, special)) = parse_keycode(keycode) {
|
|
|
|
if let Some((key_text, special)) = parse_keycode(keycode) {
|
|
|
|
let will_text_input =
|
|
|
|
let will_text_input =
|
|
|
|
|
|
|
|
|
|
|
|
!modifiers.contains(Mod::LCTRLMOD) &&
|
|
|
|
!modifiers.contains(Mod::LCTRLMOD) &&
|
|
|
|
!modifiers.contains(Mod::RCTRLMOD) &&
|
|
|
|
!modifiers.contains(Mod::RCTRLMOD) &&
|
|
|
|
!modifiers.contains(Mod::LALTMOD) &&
|
|
|
|
!modifiers.contains(Mod::LALTMOD) &&
|
|
|
@ -118,15 +120,20 @@ pub fn ui_loop() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BRIDGE.queue_command(UiCommand::Keyboard(append_modifiers(modifiers, key_text, special)));
|
|
|
|
BRIDGE.queue_command(UiCommand::Keyboard(append_modifiers(modifiers, key_text, special)));
|
|
|
|
|
|
|
|
ignore_text_input = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Event::TextInput { text, .. } => {
|
|
|
|
Event::TextInput { text, .. } => {
|
|
|
|
|
|
|
|
if ignore_text_input {
|
|
|
|
|
|
|
|
ignore_text_input = false;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
let text = if text == "<" {
|
|
|
|
let text = if text == "<" {
|
|
|
|
String::from("<lt>")
|
|
|
|
String::from("<lt>")
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
text
|
|
|
|
text
|
|
|
|
};
|
|
|
|
};
|
|
|
|
BRIDGE.queue_command(UiCommand::Keyboard(text))
|
|
|
|
BRIDGE.queue_command(UiCommand::Keyboard(text))
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Event::MouseMotion { x, y, .. } => {
|
|
|
|
Event::MouseMotion { x, y, .. } => {
|
|
|
|
let grid_x = (x as f32 / renderer.font_width) as i64;
|
|
|
|
let grid_x = (x as f32 / renderer.font_width) as i64;
|
|
|
|