Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.2.3 #62

Merged
merged 3 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

[workspace.package]
authors = ["IDEDARY"]
version = "0.2.2"
version = "0.2.3"
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/bytestring-net/bevy-lunex"
Expand All @@ -26,8 +26,8 @@

[workspace.dependencies]

bevy_lunex = { path = "crates/bevy_lunex", version = "0.2.2" }
lunex_engine = { path = "crates/lunex_engine", version = "0.2.2" }
bevy_lunex = { path = "crates/bevy_lunex", version = "0.2.3" }
lunex_engine = { path = "crates/lunex_engine", version = "0.2.3" }

colored = { version = "^2.1" }
indexmap = { version = "^2.1" }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ For production ready example/template check out [`Bevypunk source code`](https:/

| Bevy | Bevy Lunex |
|--------|-----------------|
| 0.14.0 | 0.2.0 - 0.2.2 |
| 0.14.0 | 0.2.0 - 0.2.3 |
| 0.13.2 | 0.1.0 |
| 0.12.1 | 0.0.10 - 0.0.11 |
| 0.12.0 | 0.0.7 - 0.0.9 |
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_lunex/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ For production ready example/template check out [`Bevypunk source code`](https:/

| Bevy | Bevy Lunex |
|--------|-----------------|
| 0.14.0 | 0.2.0 - 0.2.2 |
| 0.14.0 | 0.2.0 - 0.2.3 |
| 0.13.2 | 0.1.0 |
| 0.12.1 | 0.0.10 - 0.0.11 |
| 0.12.0 | 0.0.7 - 0.0.9 |
Expand Down
2 changes: 1 addition & 1 deletion crates/lunex_engine/src/core/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl <N:Default + Component> UiNodeComputeTrait for UiNode<N> {
};

// Adding depth
node_data.rectangle.pos.z = depth + node_data.depth_bias;
node_data.rectangle.pos.z = (depth + node_data.depth_bias)*absolute_scale;
node_data.rectangle

} else { return; };
Expand Down
16 changes: 13 additions & 3 deletions crates/lunex_engine/src/core/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,26 @@ impl <N: Default + Component> UiNodeDataTrait<N> for UiNode<N> {
/// Trait that abstracts over [`NodeTreeInitTrait`] to provide tailored
/// implementations for the primitive in layouting context.
pub trait UiNodeTreeInitTrait {
/// Creates new [`UiTree`].
fn new(name: impl Borrow<str>) -> Self;
/// Creates new [`UiTree`] configured for 2D enviroment.
fn new2d(name: impl Borrow<str>) -> Self;
/// Creates new [`UiTree`] configured for 3D enviroment.
fn new3d(name: impl Borrow<str>) -> Self;
}
impl <T, N: Default + Component> UiNodeTreeInitTrait for UiTree<T, N> {
fn new(name: impl Borrow<str>) -> Self {
fn new2d(name: impl Borrow<str>) -> Self {
let mut tree: UiTree<T, N> = NodeTreeInitTrait::new(name);
tree.add_topdata(MasterData::default());
tree.add_data(NodeData::default());
tree
}
fn new3d(name: impl Borrow<str>) -> Self {
let mut tree: UiTree<T, N> = NodeTreeInitTrait::new(name);
let mut md = MasterData::default();
md.abs_scale = 0.001;
tree.add_topdata(md);
tree.add_data(NodeData::default());
tree
}
}


Expand Down
2 changes: 1 addition & 1 deletion docs/src/advanced/abstraction/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn build_route(mut commands: Commands, assets: Res<AssetServer>, query: Query<En
commands.entity(entity).insert((
// Insert this bundle into the entity that just got the CustomButtom component
// Note that CustomButtonUi is used here instead of MainUi
UiTreeBundle::<CustomButtonUi>::from(UiTree::new("CustomButton")),
UiTreeBundle::<CustomButtonUi>::from(UiTree::new2d("CustomButton")),

// Now spawn the UI as children
)).with_children(|ui| {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/advanced/abstraction/routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn build_route(mut commands: Commands, assets: Res<AssetServer>, query: Query<En

// Here you can spawn the UI
route.spawn((
UiTreeBundle::<MainUi>::from(UiTree::new("MyRoute")),
UiTreeBundle::<MainUi>::from(UiTree::new2d("MyRoute")),
MovableByCamera,
)).with_children(|ui| {

Expand Down
2 changes: 1 addition & 1 deletion docs/src/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Add the following to your `Cargo.toml`:

```toml
[dependencies]
bevy_lunex = { version = "0.2.2" }
bevy_lunex = { version = "0.2.3" }
```

Alternatively, you can use the latest bleeding edge version from the Git repository:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ commands.spawn((
MovableByCamera,

// This is our UI system
UiTreeBundle::<MainUi>::from(UiTree::new("Hello UI!")),
UiTreeBundle::<MainUi>::from(UiTree::new2d("Hello UI!")),

)).with_children(|ui| {
// Here we will spawn our UI as children
Expand Down
2 changes: 1 addition & 1 deletion examples/mesh2d/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn setup(mut cmd: Commands, mut materials: ResMut<Assets<ColorMaterial>>) {
// Spawn UiTree
cmd.spawn((
UiTreeBundle::<MainUi> {
tree: UiTree::new("MyUiSystem"),
tree: UiTree::new2d("MyUiSystem"),
..default()
},
MovableByCamera,
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn setup(mut cmd: Commands, assets: Res<AssetServer>) {
// Spawn UiTree
cmd.spawn((
UiTreeBundle::<MainUi> {
tree: UiTree::new("MyUiSystem"),
tree: UiTree::new2d("MyUiSystem"),
..default()
},
MovableByCamera,
Expand Down
2 changes: 1 addition & 1 deletion examples/worldspace/src/boilerplate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn rotate_playercam(mut mouse_motion_events: EventReader<MouseMotion>, mouse
pub fn zoom_playercam(mut mouse_wheel_events: EventReader<MouseWheel>, mut query: Query<&mut PlayerCam>) {
let delta: f32 = mouse_wheel_events.read().map(|e| e.y).sum();
for mut camera in &mut query {
camera.distance += -delta*25.0;
camera.distance += -delta * camera.distance/25.0;
}
}

Expand Down
6 changes: 3 additions & 3 deletions examples/worldspace/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn setup(
Camera3dBundle::default(),
PlayerCam {
orbit: Vec3::new(0.0, 0.0, 0.0),
distance: 800.0,
distance: 2.0,
sensitivity: Vec2::splat(0.1),
}
));
Expand All @@ -37,8 +37,8 @@ fn setup(
// Spawn the floating Ui panel
commands.spawn((
UiTreeBundle::<MainUi> {
transform: Transform::from_xyz(-400.0, 300.0, 0.0 + (300.0 * x as f32)),
tree: UiTree::new("PanelWidget"),
transform: Transform::from_xyz(-0.4, 0.3, 0.0 + (0.3 * x as f32)),
tree: UiTree::new3d("PanelWidget"),
..default()
},
)).with_children(|ui| {
Expand Down