Skip to content

Commit

Permalink
Refactor place of default editor control settings
Browse files Browse the repository at this point in the history
Former-commit-id: 145b77d
  • Loading branch information
janhohenheim committed Feb 20, 2023
1 parent 0958af2 commit df8c5bd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
17 changes: 16 additions & 1 deletion src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ pub struct DevPlugin;
impl Plugin for DevPlugin {
fn build(&self, app: &mut App) {
{
app.add_plugin(EditorPlugin)
app.insert_resource(default_editor_controls())
.add_plugin(EditorPlugin)
.add_plugin(FrameTimeDiagnosticsPlugin::default())
.add_plugin(DebugLinesPlugin::default())
.add_plugin(SceneEditorPlugin)
Expand All @@ -26,3 +27,17 @@ impl Plugin for DevPlugin {
}
}
}

fn default_editor_controls() -> bevy_editor_pls::controls::EditorControls {
use bevy_editor_pls::controls::*;
let mut editor_controls = EditorControls::default_bindings();
editor_controls.unbind(Action::PlayPauseEditor);
editor_controls.insert(
Action::PlayPauseEditor,
Binding {
input: UserInput::Single(Button::Keyboard(KeyCode::Q)),
conditions: vec![BindingCondition::ListeningForText(false)],
},
);
editor_controls
}
15 changes: 0 additions & 15 deletions src/dev/scene_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ impl Plugin for SceneEditorPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<SceneEditorState>()
.add_editor_window::<FoxtrotDevWindow>()
.insert_resource(default_editor_controls())
.add_system_set(
SystemSet::on_update(GameState::Playing)
.with_system(handle_debug_render)
Expand Down Expand Up @@ -206,17 +205,3 @@ fn handle_navmesh_render(
}
}
}

fn default_editor_controls() -> bevy_editor_pls::controls::EditorControls {
use bevy_editor_pls::controls::*;
let mut editor_controls = EditorControls::default_bindings();
editor_controls.unbind(Action::PlayPauseEditor);
editor_controls.insert(
Action::PlayPauseEditor,
Binding {
input: UserInput::Single(Button::Keyboard(KeyCode::Q)),
conditions: vec![BindingCondition::ListeningForText(false)],
},
);
editor_controls
}

0 comments on commit df8c5bd

Please sign in to comment.