cleanup config ui
This commit is contained in:
parent
d62dbe3462
commit
04e7e4090d
1 changed files with 9 additions and 9 deletions
18
src/input.rs
18
src/input.rs
|
@ -96,29 +96,29 @@ impl Input {
|
||||||
globals.mouse.clear();
|
globals.mouse.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let buttons_x = 220;
|
||||||
|
let binding_text_x = buttons_x + 135;
|
||||||
|
|
||||||
for action_index in 0..ActionId::SIZE {
|
for action_index in 0..ActionId::SIZE {
|
||||||
let action = ActionId::from_usize(action_index).unwrap();
|
let action = ActionId::from_usize(action_index).unwrap();
|
||||||
|
|
||||||
d.draw_text(&format!("{action:?}"), 16, y, 20, Color::ORANGE);
|
d.draw_text(&format!("{action:?}"), 16, y, 20, Color::ORANGE);
|
||||||
if self.bindings[action_index].is_empty() {
|
|
||||||
y += 32;
|
|
||||||
}
|
|
||||||
for (binding_index, binding) in self.bindings[action_index].iter().enumerate() {
|
for (binding_index, binding) in self.bindings[action_index].iter().enumerate() {
|
||||||
if text_button(d, &globals.mouse, 160, y, 80, "remove") {
|
if text_button(d, &globals.mouse, buttons_x, y, 80, "remove") {
|
||||||
self.bindings[action_index].remove(binding_index);
|
self.bindings[action_index].remove(binding_index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if text_button(d, &globals.mouse, 245, y, 45, "edit") {
|
if text_button(d, &globals.mouse, buttons_x + 85, y, 45, "edit") {
|
||||||
self.editing_binding = Some((action, binding_index, BindingEdit::Init));
|
self.editing_binding = Some((action, binding_index, BindingEdit::Init));
|
||||||
}
|
}
|
||||||
let trigger = format!("{:?}", binding.trigger);
|
let trigger = format!("{:?}", binding.trigger);
|
||||||
d.draw_text(&trigger, 300, y, 20, Color::LIMEGREEN);
|
d.draw_text(&trigger, binding_text_x, y + 5, 20, Color::LIMEGREEN);
|
||||||
let x = 310 + d.measure_text(&trigger, 20);
|
let x = binding_text_x + 10 + d.measure_text(&trigger, 20);
|
||||||
let modifiers = format!("{:?}", binding.modifiers);
|
let modifiers = format!("{:?}", binding.modifiers);
|
||||||
d.draw_text(&modifiers, x, y, 20, Color::LIGHTBLUE);
|
d.draw_text(&modifiers, x, y + 5, 20, Color::LIGHTBLUE);
|
||||||
y += 32;
|
y += 32;
|
||||||
}
|
}
|
||||||
if text_button(d, &globals.mouse, 160, y, 130, "add binding") {
|
if text_button(d, &globals.mouse, buttons_x, y, 130, "add binding") {
|
||||||
self.editing_binding =
|
self.editing_binding =
|
||||||
Some((action, self.bindings[action_index].len(), BindingEdit::Init));
|
Some((action, self.bindings[action_index].len(), BindingEdit::Init));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue