-
Notifications
You must be signed in to change notification settings - Fork 31
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
Migrate to bevy 0.11 #65
Conversation
this is the best I can do to bring this to bevy 0.11, I hade to cut overflow since it is a struct now and I don't know how to convert. also the mouse position is inverted the top is the bottom and vice virce, don't know where to look to fix that one
not quite sure why vscode is not showing some errors
I still have questions about some of the other comments, like removing undefined outright, I like that ess is close to css and should keep it unless it is impossible to represent with Bevy, and if it is removed should also only be depreciated otherwise the parser fails and brakes shit in a unnecessary way, just emit a warning till bevy 0.12?
it does not need to be mut
- introduce ReadySystemSet for `ready` signals - relations systems runs twice: in PreUpdate after input and in PostUpdate after ready - relations systems got strong ordering: binds, connections, custom - so on:ready signals have higher priority then binds
Not cpu do not leak over time when adding new connections
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disregard my comments on Undefined. I've read PR description. And it's cool.
this is actually 4 PR merged in one
- update to bevy 0.11
- step 1 in removal of undefined var
- style refactoring (min_width and width props moved e.t.c.)
- update examples
would be easier to maintain and review.
Besides that, great job. Hopefully I'll be able to use this in my game after merge.
@@ -412,6 +412,7 @@ pub trait Widget { | |||
ctx.insert(policy); | |||
ctx.insert(Interaction::default()); | |||
} | |||
ctx.insert(Name::new(self.name().as_str())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if Name is already there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth adding some prefix so it would be obvious where the name comes from. like "belly_" maybe?
@@ -35,7 +35,7 @@ style_property! { | |||
} | |||
|
|||
compound_style_property! { | |||
#[doc = " Specify element position by providing values to `Style.position`:"] | |||
#[doc = " Specify element position by providing values to `Style.top` `Style.left` `Style.bottom` `Style.right`:"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -55,6 +55,35 @@ impl PropertyParser<Val> for ValParser { | |||
} | |||
} | |||
|
|||
pub fn overflow(prop: &StyleProperty) -> Result<Overflow, ElementsError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
@@ -90,7 +90,8 @@ impl StylePropertyToken { | |||
StylePropertyToken::Percentage(p) => Ok(Val::Percent(p.to_float())), | |||
StylePropertyToken::Dimension(d, u) if u == "px" => Ok(Val::Px(d.to_float())), | |||
StylePropertyToken::Identifier(i) if i == "auto" => Ok(Val::Auto), | |||
StylePropertyToken::Identifier(i) if i == "undefined" => Ok(Val::Undefined), | |||
StylePropertyToken::Identifier(i) if i == "undefined" => Ok(Val::Px(0.)), | |||
StylePropertyToken::Identifier(i) if i == "undefined" => Ok(Val::Px(0.)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this seems to be like an implicit rule. Maybe use 0 explicitly and deprecate undefined value.
let watchers = self.watchers.write().unwrap(); | ||
if watchers.contains(&watcher) { | ||
return; | ||
if !self.watchers.read().unwrap().contains(&watcher) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If two watches would contain two watchers, which watch would watch which watcher
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previous version with early returns was nicer. but yeah, does not work the same.
@@ -4,8 +4,9 @@ use belly_macro::*; | |||
use bevy::{ | |||
asset::Asset, | |||
prelude::*, | |||
utils::{HashMap, HashSet}, | |||
// utils::{HashMap, HashSet}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yack
@@ -99,7 +99,7 @@ stylebox-source: "images/stylebox.png" | |||
<!-- @property-type=$val --> | |||
Size type representing `bevy::prelude::Val` type. Possible values: | |||
- `auto` for `Val::Auto` | |||
- `undefined` for `Val::Undefined` | |||
- `undefined` for `Val::Px(0.)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kinda weird, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, if you need an undefined
defined value, then it should probably map to Val::Auto
.
.in_base_set(CoreSet::PreUpdate) | ||
.in_set(Label::Signals) | ||
.after(InputSystem), | ||
.add_systems( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add comments on what is happening here? This is the most complex place in whole PR and seems like it's a very important, it defines input processing pipeline, I can't comprehend.
About
This is migration to bevy 0.11 PR.
A lot of work was done by @PhaestusFox in #63, and this PR is logical continuation of his work. If you want to contribute to bevy-011 version, please make pr to this branch.
You can test this by adding belly to deps:
# bash cargo add --git https://github.com/jkb0o/belly.git --branch bevy-0.11 belly
Tracker
undefined
style properties in favour of removedVal::Undefined
Known bugs:
flex-grow: 1
and text inside have invalid size, relates to Invalid node size calculation for text + flex_grow: 1.0 bevyengine/bevy#9350