show key bindings in menu instead of with F1 key
This commit is contained in:
parent
5a3f3bd96f
commit
31705586cd
|
@ -29,7 +29,7 @@ Source code: https://codeberg.org/hut/outfly
|
|||
|
||||
# Controls
|
||||
|
||||
- F1: Show key bindings
|
||||
- ESC: Menu, show key bindings and achievements
|
||||
- Space: Slow down (or match velocity)
|
||||
- AWSD/Shift/Ctrl: Accelerate
|
||||
- R: Rotate (hold & move mouse)
|
||||
|
@ -41,7 +41,6 @@ Source code: https://codeberg.org/hut/outfly
|
|||
- C: Camera
|
||||
- Y: Toggle rotation stabilizer
|
||||
- F11: Fullscreen
|
||||
- ESC: Menu
|
||||
- JKULIO: Mouseless camera rotation
|
||||
- Augmented Reality: (toggle with Tab)
|
||||
- Left click: Target objects
|
||||
|
|
|
@ -942,19 +942,12 @@ fn handle_input(
|
|||
keyboard_input: Res<ButtonInput<KeyCode>>,
|
||||
mouse_input: Res<ButtonInput<MouseButton>>,
|
||||
settings: Res<Settings>,
|
||||
mut log: ResMut<Log>,
|
||||
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
|
||||
mut ew_target: EventWriter<TargetEvent>,
|
||||
mut ew_game: EventWriter<GameEvent>,
|
||||
q_objects: Query<(Entity, &Transform), (With<IsClickable>, Without<IsTargeted>, Without<actor::PlayerDrivesThis>, Without<actor::Player>)>,
|
||||
q_camera: Query<&Transform, With<Camera>>,
|
||||
) {
|
||||
if keyboard_input.just_pressed(settings.key_help) {
|
||||
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Click));
|
||||
for line in include_str!("data/keybindings.in").trim().lines().rev() {
|
||||
log.add(line.to_string(), "".to_string(), LogLevel::Always);
|
||||
}
|
||||
}
|
||||
if keyboard_input.just_pressed(settings.key_togglehud) {
|
||||
ew_game.send(GameEvent::SetAR(Turn::Toggle));
|
||||
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Switch));
|
||||
|
|
36
src/menu.rs
36
src/menu.rs
|
@ -239,6 +239,42 @@ pub fn setup(
|
|||
},
|
||||
));
|
||||
});
|
||||
|
||||
let keybindings = include_str!("data/keybindings.in");
|
||||
let style_keybindings = TextStyle {
|
||||
font: font_handle.clone(),
|
||||
font_size: settings.font_size_keybindings,
|
||||
color: settings.hud_color_keybindings,
|
||||
..default()
|
||||
};
|
||||
|
||||
commands.spawn((
|
||||
MenuElement,
|
||||
NodeBundle {
|
||||
style: Style {
|
||||
width: Val::Percent(96.0),
|
||||
height: Val::Percent(96.0),
|
||||
left: Val::Percent(2.0),
|
||||
top: Val::Percent(2.0),
|
||||
align_items: AlignItems::Start,
|
||||
justify_content: JustifyContent::End,
|
||||
..default()
|
||||
},
|
||||
visibility: Visibility::Hidden,
|
||||
..default()
|
||||
},
|
||||
)).with_children(|builder| {
|
||||
builder.spawn((
|
||||
TextBundle {
|
||||
text: Text {
|
||||
sections: vec![TextSection::new(keybindings, style_keybindings)],
|
||||
justify: JustifyText::Right,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
},
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
pub fn show_deathscreen(
|
||||
|
|
|
@ -59,6 +59,7 @@ pub struct Settings {
|
|||
pub font_size_death_achievements: f32,
|
||||
pub font_size_achievement: f32,
|
||||
pub font_size_achievement_header: f32,
|
||||
pub font_size_keybindings: f32,
|
||||
pub hud_color: Color,
|
||||
pub hud_color_fps: Color,
|
||||
pub hud_color_console: Color,
|
||||
|
@ -75,6 +76,7 @@ pub struct Settings {
|
|||
pub hud_color_achievement_accomplished: Color,
|
||||
pub hud_color_death: Color,
|
||||
pub hud_color_death_achievements: Color,
|
||||
pub hud_color_keybindings: Color,
|
||||
pub chat_speed: f32,
|
||||
pub flashlight_active: bool,
|
||||
pub hud_active: bool,
|
||||
|
@ -181,6 +183,7 @@ impl Default for Settings {
|
|||
font_size_death_achievements: 24.0,
|
||||
font_size_achievement: 24.0,
|
||||
font_size_achievement_header: 32.0,
|
||||
font_size_keybindings: 20.0,
|
||||
hud_color: Color::hex("#BE1251").unwrap(),
|
||||
hud_color_fps: Color::hex("#181818").unwrap(),
|
||||
hud_color_console: Color::hex("#BE1251").unwrap(),
|
||||
|
@ -197,6 +200,7 @@ impl Default for Settings {
|
|||
hud_color_achievement_header: Color::hex("#BE1251").unwrap(),
|
||||
hud_color_death: Color::hex("#CCCCCC").unwrap(),
|
||||
hud_color_death_achievements: Color::hex("#CCCCCC").unwrap(),
|
||||
hud_color_keybindings: Color::hex("#999999").unwrap(),
|
||||
chat_speed: DEFAULT_CHAT_SPEED * if dev_mode { 2.5 } else { 1.0 },
|
||||
flashlight_active: false,
|
||||
hud_active: true,
|
||||
|
|
Loading…
Reference in a new issue