Skip to content

Commit

Permalink
chore(deps): update bevy to v0.13 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShenMian authored Feb 20, 2024
1 parent 03882c3 commit fd1cc30
Show file tree
Hide file tree
Showing 11 changed files with 750 additions and 1,006 deletions.
1,557 changes: 652 additions & 905 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@ nalgebra = "0.32"
itertools = "0.12.0"
siphasher = "1.0"

serde = { version = "1.0", features = ["derive"] }

bevy = "0.12"
leafwing-input-manager = "0.11"
bevy_kira_audio = "0.18"
bevy = "0.13"
leafwing-input-manager = "0.13"
bevy_kira_audio = "0.19"
benimator = "4.1"
bevy_editor_pls = "0.7"

serde = { version = "1.0", features = ["derive"] }
rusqlite = { version = "0.31", features = ["bundled"] }
arboard = "3.3" # 系统剪切板
image = "0.24"
winit = "0.28" # 版本需要与 bevy 中使用的保持一致
winit = "0.29" # 版本需要与 bevy 中使用的保持一致
toml = "0.8"

[profile.dev.package."*"]
Expand Down
106 changes: 53 additions & 53 deletions src/input_action_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,153 +35,153 @@ pub fn default_input_action_map() -> InputMap<Action> {
use leafwing_input_manager::user_input::InputKind::*;
let mouse_input_map = InputMap::new([
(
UserInput::Single(Mouse(MouseButton::Other(1))),
Action::Undo,
UserInput::Single(Mouse(MouseButton::Other(1))),
),
(
UserInput::Single(Mouse(MouseButton::Other(2))),
Action::Redo,
UserInput::Single(Mouse(MouseButton::Other(2))),
),
(
UserInput::Single(MouseWheel(MouseWheelDirection::Down)),
Action::ZoomOut,
UserInput::Single(MouseWheel(MouseWheelDirection::Down)),
),
(
UserInput::Single(MouseWheel(MouseWheelDirection::Up)),
Action::ZoomIn,
UserInput::Single(MouseWheel(MouseWheelDirection::Up)),
),
]);
let keyboard_input_map = InputMap::new([
(UserInput::Single(Keyboard(KeyCode::W)), Action::MoveUp),
(UserInput::Single(Keyboard(KeyCode::S)), Action::MoveDown),
(UserInput::Single(Keyboard(KeyCode::A)), Action::MoveLeft),
(UserInput::Single(Keyboard(KeyCode::D)), Action::MoveRight),
(UserInput::Single(Keyboard(KeyCode::Up)), Action::MoveUp),
(UserInput::Single(Keyboard(KeyCode::Down)), Action::MoveDown),
(UserInput::Single(Keyboard(KeyCode::Left)), Action::MoveLeft),
(
UserInput::Single(Keyboard(KeyCode::Right)),
(Action::MoveUp, UserInput::Single(PhysicalKey(KeyCode::KeyW))),
(Action::MoveDown, UserInput::Single(PhysicalKey(KeyCode::KeyS))),
(Action::MoveLeft, UserInput::Single(PhysicalKey(KeyCode::KeyA))),
(Action::MoveRight, UserInput::Single(PhysicalKey(KeyCode::KeyD))),
(Action::MoveUp, UserInput::Single(PhysicalKey(KeyCode::ArrowUp))),
(Action::MoveDown, UserInput::Single(PhysicalKey(KeyCode::ArrowDown))),
(Action::MoveLeft, UserInput::Single(PhysicalKey(KeyCode::ArrowLeft))),
(
Action::MoveRight,
UserInput::Single(PhysicalKey(KeyCode::ArrowRight)),
),
(
UserInput::Chord(vec![Keyboard(KeyCode::ControlLeft), Keyboard(KeyCode::Z)]),
Action::Undo,
UserInput::Chord(vec![PhysicalKey(KeyCode::ControlLeft), PhysicalKey(KeyCode::KeyZ)]),
),
(
Action::Redo,
UserInput::Chord(vec![
Keyboard(KeyCode::ControlLeft),
Keyboard(KeyCode::ShiftLeft),
Keyboard(KeyCode::Z),
PhysicalKey(KeyCode::ControlLeft),
PhysicalKey(KeyCode::ShiftLeft),
PhysicalKey(KeyCode::KeyZ),
]),
Action::Redo,
),
(
UserInput::Single(Keyboard(KeyCode::Escape)),
Action::ResetLevel,
UserInput::Single(PhysicalKey(KeyCode::Escape)),
),
(
UserInput::Single(Keyboard(KeyCode::BracketRight)),
Action::NextLevel,
UserInput::Single(PhysicalKey(KeyCode::BracketRight)),
),
(
UserInput::Single(Keyboard(KeyCode::BracketLeft)),
Action::PreviousLevel,
UserInput::Single(PhysicalKey(KeyCode::BracketLeft)),
),
(
Action::NextUnsolvedLevel,
UserInput::Chord(vec![
Keyboard(KeyCode::ControlLeft),
Keyboard(KeyCode::BracketRight),
PhysicalKey(KeyCode::ControlLeft),
PhysicalKey(KeyCode::BracketRight),
]),
Action::NextUnsolvedLevel,
),
(
Action::PreviousUnsolvedLevel,
UserInput::Chord(vec![
Keyboard(KeyCode::ControlLeft),
Keyboard(KeyCode::BracketLeft),
PhysicalKey(KeyCode::ControlLeft),
PhysicalKey(KeyCode::BracketLeft),
]),
Action::PreviousUnsolvedLevel,
),
(UserInput::Single(Keyboard(KeyCode::Equals)), Action::ZoomIn),
(UserInput::Single(Keyboard(KeyCode::Minus)), Action::ZoomOut),
(Action::ZoomIn, UserInput::Single(PhysicalKey(KeyCode::Equal))),
(Action::ZoomOut, UserInput::Single(PhysicalKey(KeyCode::Minus))),
(
UserInput::Single(Keyboard(KeyCode::I)),
Action::ToggleInstantMove,
UserInput::Single(PhysicalKey(KeyCode::KeyI)),
),
(
UserInput::Single(Keyboard(KeyCode::P)),
Action::ToggleAutomaticSolution,
UserInput::Single(PhysicalKey(KeyCode::KeyP)),
),
(
UserInput::Single(Keyboard(KeyCode::F11)),
Action::ToggleFullscreen,
UserInput::Single(PhysicalKey(KeyCode::F11)),
),
(
UserInput::Chord(vec![Keyboard(KeyCode::ControlLeft), Keyboard(KeyCode::V)]),
Action::ImportLevelsFromClipboard,
UserInput::Chord(vec![PhysicalKey(KeyCode::ControlLeft), PhysicalKey(KeyCode::KeyV)]),
),
(
UserInput::Chord(vec![Keyboard(KeyCode::ControlLeft), Keyboard(KeyCode::C)]),
Action::ExportLevelToClipboard,
UserInput::Chord(vec![PhysicalKey(KeyCode::ControlLeft), PhysicalKey(KeyCode::KeyC)]),
),
// Keyboard (Vim)
(UserInput::Single(Keyboard(KeyCode::K)), Action::MoveUp),
(UserInput::Single(Keyboard(KeyCode::J)), Action::MoveDown),
(UserInput::Single(Keyboard(KeyCode::H)), Action::MoveLeft),
(UserInput::Single(Keyboard(KeyCode::L)), Action::MoveRight),
(UserInput::Single(Keyboard(KeyCode::U)), Action::Undo),
// PhysicalKey (Vim)
(Action::MoveUp, UserInput::Single(PhysicalKey(KeyCode::KeyK))),
(Action::MoveDown, UserInput::Single(PhysicalKey(KeyCode::KeyJ))),
(Action::MoveLeft, UserInput::Single(PhysicalKey(KeyCode::KeyH))),
(Action::MoveRight, UserInput::Single(PhysicalKey(KeyCode::KeyL))),
(Action::Undo, UserInput::Single(PhysicalKey(KeyCode::KeyU))),
(
UserInput::Chord(vec![Keyboard(KeyCode::ControlLeft), Keyboard(KeyCode::R)]),
Action::Redo,
UserInput::Chord(vec![PhysicalKey(KeyCode::ControlLeft), PhysicalKey(KeyCode::KeyR)]),
),
]);
let gamepad_input_map = InputMap::new([
(
UserInput::Single(GamepadButton(GamepadButtonType::DPadUp)),
Action::MoveUp,
UserInput::Single(GamepadButton(GamepadButtonType::DPadUp)),
),
(
UserInput::Single(GamepadButton(GamepadButtonType::DPadDown)),
Action::MoveDown,
UserInput::Single(GamepadButton(GamepadButtonType::DPadDown)),
),
(
UserInput::Single(GamepadButton(GamepadButtonType::DPadLeft)),
Action::MoveLeft,
UserInput::Single(GamepadButton(GamepadButtonType::DPadLeft)),
),
(
UserInput::Single(GamepadButton(GamepadButtonType::DPadRight)),
Action::MoveRight,
UserInput::Single(GamepadButton(GamepadButtonType::DPadRight)),
),
(
UserInput::Single(GamepadButton(GamepadButtonType::East)),
Action::Undo,
UserInput::Single(GamepadButton(GamepadButtonType::East)),
),
(
UserInput::Single(GamepadButton(GamepadButtonType::South)),
Action::Redo,
UserInput::Single(GamepadButton(GamepadButtonType::South)),
),
(
UserInput::Single(GamepadButton(GamepadButtonType::RightTrigger)),
Action::NextLevel,
UserInput::Single(GamepadButton(GamepadButtonType::RightTrigger)),
),
(
UserInput::Single(GamepadButton(GamepadButtonType::LeftTrigger)),
Action::PreviousLevel,
UserInput::Single(GamepadButton(GamepadButtonType::LeftTrigger)),
),
(
UserInput::Single(GamepadButton(GamepadButtonType::RightTrigger2)),
Action::ZoomIn,
UserInput::Single(GamepadButton(GamepadButtonType::RightTrigger2)),
),
(
UserInput::Single(GamepadButton(GamepadButtonType::LeftTrigger2)),
Action::ZoomOut,
UserInput::Single(GamepadButton(GamepadButtonType::LeftTrigger2)),
),
(
UserInput::Single(GamepadButton(GamepadButtonType::West)),
Action::ToggleInstantMove,
UserInput::Single(GamepadButton(GamepadButtonType::West)),
),
(
UserInput::Single(GamepadButton(GamepadButtonType::North)),
Action::ToggleAutomaticSolution,
UserInput::Single(GamepadButton(GamepadButtonType::North)),
),
]);
InputMap::default()
Expand Down
6 changes: 1 addition & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ use systems::level::*;
use systems::render::*;
use systems::ui::*;

#[allow(unused_imports)]
use bevy_editor_pls::prelude::*;

const CONFIG_FILE_PATH: &'static str = "config.toml";

fn load_config() -> Config {
Expand Down Expand Up @@ -80,9 +77,8 @@ fn main() {
AudioPlugin,
PerformanceMatrixPlugin,
InputManagerPlugin::<Action>::default(),
// EditorPlugin::default(),
))
.add_state::<AppState>()
.init_state::<AppState>()
.add_systems(PreStartup, (setup_camera, setup_database))
.add_systems(
Startup,
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/performance_matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn update_performance_matrix(
mut query: Query<&mut Text, With<PerformanceCounter>>,
) {
let mut text = query.single_mut();
if let Some(fps) = diagnostics.get(FrameTimeDiagnosticsPlugin::FPS) {
if let Some(fps) = diagnostics.get(&FrameTimeDiagnosticsPlugin::FPS) {
if let Some(raw) = fps.value() {
text.sections[1].value = format!("{raw:.2}\n");
}
Expand Down
12 changes: 6 additions & 6 deletions src/systems/auto_move.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ pub fn spawn_auto_move_marks(
mut commands: Commands,
mut auto_move_state: ResMut<AutoMoveState>,
board: Query<&Board>,
mut crates: Query<(&GridPosition, &mut TextureAtlasSprite), (With<Crate>, Without<Player>)>,
mut player: Query<&mut TextureAtlasSprite, With<Player>>,
mut crates: Query<(&GridPosition, &mut Sprite), (With<Crate>, Without<Player>)>,
mut player: Query<&mut Sprite, With<Player>>,
mut next_state: ResMut<NextState<AppState>>,
) {
let Board { board, tile_size } = board.single();
Expand Down Expand Up @@ -55,7 +55,7 @@ pub fn spawn_auto_move_marks(
// highlight selected crate
crates
.iter_mut()
.filter(|(grid_position, _)| ***grid_position == *crate_position)
.filter(|(grid_position, ..)| ***grid_position == *crate_position)
.for_each(|(_, mut sprite)| sprite.color = HIGHLIGHT_COLOR);
}
AutoMoveState::Player => {
Expand Down Expand Up @@ -98,8 +98,8 @@ pub fn spawn_auto_move_marks(
/// Despawns the auto-move reachable marks on the board.
pub fn despawn_auto_move_marks(
mut commands: Commands,
mut crates: Query<(&GridPosition, &mut TextureAtlasSprite), (With<Crate>, Without<Player>)>,
mut player: Query<&mut TextureAtlasSprite, With<Player>>,
mut crates: Query<(&GridPosition, &mut Sprite), (With<Crate>, Without<Player>)>,
mut player: Query<&mut Sprite, With<Player>>,
marks: Query<Entity, Or<(With<CratePushableMark>, With<PlayerMovableMark>)>>,
auto_move_state: Res<AutoMoveState>,
) {
Expand All @@ -116,5 +116,5 @@ pub fn despawn_auto_move_marks(
}
}

marks.for_each(|entity| commands.entity(entity).despawn());
marks.iter().for_each(|entity| commands.entity(entity).despawn());
}
2 changes: 1 addition & 1 deletion src/systems/auto_solve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub fn despawn_lowerbound_marks(
mut commands: Commands,
marks: Query<Entity, With<LowerBoundMark>>,
) {
marks.for_each(|entity| commands.entity(entity).despawn());
marks.iter().for_each(|entity| commands.entity(entity).despawn());
}

/// Resets the board to the state before automatic solution
Expand Down
Loading

0 comments on commit fd1cc30

Please sign in to comment.