Skip to content

Commit

Permalink
Bump version - Update to Bevy 0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
idanarye committed Dec 1, 2024
1 parent 4dda139 commit d98d12a
Show file tree
Hide file tree
Showing 16 changed files with 196 additions and 238 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
rust: [1.79.0, nightly]
rust: [1.83.0, nightly]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.79.0
toolchain: 1.83.0
components: rustfmt
- name: Run fmt --all -- --check
run: cargo fmt --all -- --check
Expand All @@ -65,7 +65,7 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.79.0
toolchain: 1.83.0
components: clippy
- name: Install dependencies
run: sudo apt-get update; sudo apt-get install --no-install-recommends libudev-dev
Expand All @@ -87,7 +87,7 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.79.0
toolchain: 1.83.0
- name: Install dependencies
run: sudo apt-get update; sudo apt-get install --no-install-recommends libudev-dev
- name: Cache cargo
Expand All @@ -112,7 +112,7 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
targets: wasm32-unknown-unknown
toolchain: 1.79.0
toolchain: 1.83.0
- name: Build docs
env:
GITHUB_REPO: ${{ github.repository }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## 0.23.0 - 2024-12-01
### Changed
- Update Bevy version to 0.15 and bevy_egui version to 0.31.

## 0.22.0 - 2024-07-06
### Changed
- Upgrade Bevy to 0.14 (and bevy_egui to 0.28)
Expand Down
19 changes: 14 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ members = ["macros"]
[package]
name = "bevy-yoleck"
description = "Your Own Level Editor Creation Kit"
version = "0.22.0"
version = "0.23.0"
edition = "2021"
authors = ["IdanArye <[email protected]>"]
license = "MIT OR Apache-2.0"
Expand All @@ -22,11 +22,14 @@ exclude = [
[dependencies]
bevy-yoleck-macros = { version = "0.9.1", path = "macros" }
anyhow = "^1"
bevy = { version = "^0.14", default-features = false, features = ["bevy_state"] }
bevy_egui = { version = "^0.28", default-features = false, features = ["default_fonts", "render"] }
bevy = { version = "^0.15", default-features = false, features = [
"bevy_state",
"bevy_window",
] }
bevy_egui = { version = "^0.31", default-features = false, features = ["default_fonts", "render"] }
serde = "^1"
serde_json = "^1"
thiserror = "^1"
thiserror = "^2"
uuid = "1.9.1"

[features]
Expand All @@ -43,7 +46,12 @@ vpeol_3d = [
]

[dev-dependencies]
bevy = { version = "^0.14", default-features = false, features = ["bevy_sprite", "x11"] }
bevy = { version = "^0.15", default-features = false, features = [
"bevy_sprite",
"x11",
"bevy_window",
"bevy_text",
] }

[[example]]
name = "example2d"
Expand All @@ -55,6 +63,7 @@ required-features = [
"vpeol_3d",
"bevy/bevy_scene",
"bevy/bevy_gltf",
"bevy/animation",
"bevy/ktx2",
"bevy/zstd",
"bevy/tonemapping_luts",
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ at a directory's contents). The index file contains a tuple of two values:

| bevy | bevy-yoleck | bevy_egui |
|------|-------------|-----------|
| 0.15 | 0.23 | 0.31 |
| 0.14 | 0.22 | 0.28 |
| 0.13 | 0.21 | 0.27 |
| 0.13 | 0.20 | 0.26 |
Expand Down
96 changes: 40 additions & 56 deletions examples/doors_to_other_levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,12 @@ fn main() {
}

fn setup_camera(mut commands: Commands) {
let mut camera = Camera2dBundle::default();
camera.transform.translation.z = 100.0;
camera.transform.scale *= 2.0 * (Vec3::X + Vec3::Y) + Vec3::Z;
commands
.spawn(camera)
.insert(VpeolCameraState::default())
.insert(Vpeol2dCameraControl::default());
commands.spawn((
Camera2d,
Transform::from_xyz(0.0, 0.0, 100.0).with_scale(2.0 * (Vec3::X + Vec3::Y) + Vec3::Z),
VpeolCameraState::default(),
Vpeol2dCameraControl::default(),
));
}

#[derive(Component)]
Expand All @@ -120,16 +119,13 @@ fn populate_player(
mut texture_cache: Local<Option<Handle<Image>>>,
) {
populate.populate(|_ctx, mut cmd, ()| {
cmd.insert((SpriteBundle {
sprite: Sprite {
custom_size: Some(Vec2::new(100.0, 100.0)),
..Default::default()
},
texture: texture_cache
cmd.insert(Sprite {
image: texture_cache
.get_or_insert_with(|| asset_server.load("sprites/player.png"))
.clone(),
custom_size: Some(Vec2::new(100.0, 100.0)),
..Default::default()
},));
});
});
}

Expand All @@ -147,10 +143,10 @@ fn control_camera(
let displacement = position_to_track - camera_transform.translation;
if displacement.length_squared() < 10000.0 {
camera_transform.translation +=
displacement.clamp_length_max(100.0 * time.delta_seconds());
displacement.clamp_length_max(100.0 * time.delta_secs());
} else {
camera_transform.translation +=
displacement.clamp_length_max(800.0 * time.delta_seconds());
displacement.clamp_length_max(800.0 * time.delta_secs());
}
}
}
Expand All @@ -175,7 +171,7 @@ fn control_player(
}
velocity *= 800.0;
for mut player_transform in player_query.iter_mut() {
player_transform.translation += velocity * time.delta_seconds();
player_transform.translation += velocity * time.delta_secs();
}
}

Expand Down Expand Up @@ -208,19 +204,15 @@ fn populate_text(mut populate: YoleckPopulate<&TextContent>, asset_server: Res<A
text = content.text.clone();
color = css::WHITE;
};
cmd.insert(Text2dBundle {
text: {
Text::from_section(
text,
TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 72.0,
color: color.into(),
},
)
cmd.insert((
Text2d(text),
TextFont {
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 72.0,
..Default::default()
},
..Default::default()
});
TextColor(color.into()),
));
});
}

Expand All @@ -240,7 +232,7 @@ fn edit_doorway(
};

ui.horizontal(|ui| {
egui::ComboBox::from_id_source("doorway-level")
egui::ComboBox::from_id_salt("doorway-level")
.selected_text(
Some(doorway.target_level.as_str())
.filter(|l| !l.is_empty())
Expand Down Expand Up @@ -270,18 +262,13 @@ fn edit_doorway_rotation(
// TODO: do this in vpeol_2d?
let mut rotate_knob = knobs.knob("rotate");
let knob_position = position.extend(1.0) + Quat::from_rotation_z(rotation.0) * (75.0 * Vec3::X);
rotate_knob.cmd.insert(SpriteBundle {
sprite: Sprite {
color: css::PURPLE.into(),
custom_size: Some(Vec2::new(30.0, 30.0)),
..Default::default()
},
transform: Transform::from_translation(knob_position),
global_transform: Transform::from_translation(knob_position).into(),
..Default::default()
});
rotate_knob.cmd.insert((
Sprite::from_color(css::PURPLE, Vec2::new(30.0, 30.0)),
Transform::from_translation(knob_position),
GlobalTransform::from(Transform::from_translation(knob_position)),
));
if let Some(rotate_to) = rotate_knob.get_passed_data::<Vec3>() {
rotation.0 = Vec2::X.angle_between(rotate_to.truncate() - *position);
rotation.0 = Vec2::X.angle_to(rotate_to.truncate() - *position);
}
}

Expand All @@ -292,7 +279,7 @@ fn populate_doorway(
mut texture_atlas_layout_assets: ResMut<Assets<TextureAtlasLayout>>,
) {
populate.populate(|_ctx, mut cmd, ()| {
let (texture, texture_atlas_layout) = asset_handle_cache
let (image, texture_atlas_layout) = asset_handle_cache
.get_or_insert_with(|| {
(
asset_server.load("sprites/doorway.png"),
Expand All @@ -306,26 +293,23 @@ fn populate_doorway(
)
})
.clone();
cmd.insert(SpriteBundle {
sprite: Sprite {
custom_size: Some(Vec2::new(100.0, 100.0)),
..Default::default()
},
texture,
cmd.insert(Sprite {
image,
custom_size: Some(Vec2::new(100.0, 100.0)),
texture_atlas: Some(TextureAtlas {
layout: texture_atlas_layout,
index: 0,
}),
..Default::default()
});
cmd.insert(TextureAtlas {
layout: texture_atlas_layout,
index: 0,
});
});
}

fn set_doorways_sprite_index(
mut query: Query<(&mut TextureAtlas, Has<DoorIsOpen>), With<Doorway>>,
) {
fn set_doorways_sprite_index(mut query: Query<(&mut Sprite, Has<DoorIsOpen>), With<Doorway>>) {
for (mut sprite, door_is_open) in query.iter_mut() {
sprite.index = if door_is_open { 1 } else { 0 };
if let Some(texture_atlas) = sprite.texture_atlas.as_mut() {
texture_atlas.index = if door_is_open { 1 } else { 0 };
}
}
}

Expand Down
Loading

0 comments on commit d98d12a

Please sign in to comment.