mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 09:24:26 +03:00
Add WASD alternate santa controls for someone with broken arrow keys.
This commit is contained in:
parent
bc5c4d3b2e
commit
f6f5f49329
@ -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),
|
||||
]),
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user