Add WASD alternate santa controls for someone with broken arrow keys.

This commit is contained in:
Dustin Carlino 2020-12-29 19:37:54 -08:00
parent bc5c4d3b2e
commit f6f5f49329
2 changed files with 7 additions and 5 deletions

View File

@ -77,7 +77,9 @@ impl Picker {
Widget::draw_svg(ctx, "system/assets/tools/arrow_keys.svg"),
Text::from_all(vec![
Line("arrow keys").fg(ctx.style().hotkey_color),
Line(" to move"),
Line(" to move (or "),
Line("WASD").fg(ctx.style().hotkey_color),
Line(")"),
])
.draw(ctx),
]),

View File

@ -35,16 +35,16 @@ impl InstantController {
pub fn angle_from_arrow_keys(ctx: &EventCtx) -> Option<Angle> {
let mut x: f64 = 0.0;
let mut y: f64 = 0.0;
if ctx.is_key_down(Key::LeftArrow) {
if ctx.is_key_down(Key::LeftArrow) || ctx.is_key_down(Key::A) {
x -= 1.0;
}
if ctx.is_key_down(Key::RightArrow) {
if ctx.is_key_down(Key::RightArrow) || ctx.is_key_down(Key::D) {
x += 1.0;
}
if ctx.is_key_down(Key::UpArrow) {
if ctx.is_key_down(Key::UpArrow) || ctx.is_key_down(Key::W) {
y -= 1.0;
}
if ctx.is_key_down(Key::DownArrow) {
if ctx.is_key_down(Key::DownArrow) || ctx.is_key_down(Key::S) {
y += 1.0;
}