#bevy_cobweb_ui
1333 messages ยท Page 2 of 2 (latest)
I figured out the startup time issue, it's caused by the embedded_watcher feature when you are using a workspace (see https://github.com/bevyengine/bevy/issues/17430).
Published 0.12.0: https://github.com/UkoeHB/bevy_cobweb_ui/blob/main/CHANGELOG.md#0120
A bit churny because of the naming changes. Can fix with 2 find-and-replaces:
spawn_scene->spawn_scene_simplespawn_scene_simple_and_edit->spawn_scene
Tired now I have uploaded my work so far
2025-01-24T00:53:23.987040Z WARN bevy_cobweb_ui::builtin::widgets:๐:widget: failed selecting radio button 33v1#4294967329; no RadioButtonManager found in ancestors 2025-01-24T00:53:27.466687Z WARN bevy_cobweb_ui::builtin::widgets:๐:widget: failed selecting radio button 35v1#4294967331; no RadioButtonManager found in ancestors
Should this say radioGroup?
Oh yeah, will update it
I have published most of the tab tutorial now, I still need a second chapter to introduce macros and use defines.
I also need to adjust comment samples comments to highlight changes
Cool, I will do an editing pass once you've wrapped up the remaining things.
I have almost wrapped and I realised.
fn tab_change(trigger: Trigger<TabChange>, mut c: Commands, mut s: SceneBuilder) {
if let Some(mut tab_commands) = c.get_entity(trigger.tab_content_entity) {
tab_commands.despawn_descendants();
};
//Don' need this!
c.ui_builder(trigger.tab_menu_entity)
.react()
.entity_event(trigger.button_entity, Select);
c.ui_builder(trigger.tab_content_entity)
.spawn_scene_simple(("main.cob", trigger.scene_name.clone()), &mut s);
}
I have published my progress so far but yeah I have added redundant code
I need to work backwords to remove redundant code
Done ready for your editing pass
Well there is the commenting on sample COB code but you have added those on your last edits.
Thanks will do later today or tomorrow
Just added and removed some comment highlighting changes.
Once you have done your edit pass, you can rename tab title, remove WIP.
@steel tartan ok editing done. You'll want to check the changes in the starting tab section of tab_cleanup. Much simplified.
Thanks checking it now,
Why did you add an rs on a cob file?
It adds a little coloring, which is better than black and white (albeit imperfect)
It ended up hiding the #Scenes in the intro section so I removed it there
I don't know why it did it then and why it is not doing that now
Not sure what you mean, don't see any problems in the rendered book
That change was needed to get #scenes to display properly
I don't understand why though
Huh seems rust breaks it but rs does not.
Yeah, from memory it was rs, but I went back and saw it was rust
Guess we both know from now on.
I thought of using on_select right when I finished the whole thing lol
It does take a deceptively long time to write as every error I try and go back and edit it
Also probably should ask, do you care about colour vs color?
I find that the different spelling is good for variable names
I use color exclusively but don't really care.
Will incorporate that change in my main program
Finished reading your changes thank you.
This is the best part of writing the book, is it gives me direct feedback!
The final code doesn't work it needs to be spawn_scene not spawn_scene_simple
I am guessing that is a typo as the prior code uses spawn_scene
fixed
I think we can make a post in tutorials, what do you use to record your screen?
I use TapRecord on MacOS
Dam on linux, so will look for something else.
Tried OBS, and another program either too complicated or incompatible. cbf figuring it out
Hello, how can I add 2 buttons to a flexnode with different colors?
#scenes
"root"
AbsoluteNode{width:100vw height:100vh justify_main:SpaceEvenly justify_cross:Center }
BackgroundColor(#2C2F33)
"button_board"
AbsoluteGridNode{top: 45vh left: 37.5vw width: 25vw height: 45vh justify_cross: Center justify_main: Center}
BackgroundColor(#2F4F2F)
"button"
FlexNode{width: 10vw height: 10vh justify_main: Center justify_cross: Center}
BackgroundColor(#D2691E)
"button"
FlexNode{width: 10vw height: 10vh justify_main: Center justify_cross: Center}
BackgroundColor(#00FF00)
I spawned it with commands.ui_root().spawn_scene(("mainmenu.cob", "root"), &mut scene_builder);
and it looks like this
altho I have 2 different Background colors for them
Yes, thank you.
Is there a guidebook regarding the .cob files. I have 0 experience or any idea how to make even boxes inside boxes.
Thanks.
Cobweb asset format (COB)
Second link is more technical first is more introductory
How can I solve this error?
2025-01-28T20:37:25.875704Z WARN bevy_cobweb_ui::loading::cob::sections::cob_scenes: encountered scene item that isn't aligned with other items in the same layer at file: mainmenu.cob, line: 13, column: 17; item indent: 16, expected: 12
2025-01-28T20:37:25.876051Z WARN bevy_cobweb_ui::loading::cob::sections::cob_scenes: encountered scene item that isn't aligned with other items in the same layer at file: mainmenu.cob, line: 16, column: 17; item indent: 16, expected: 12
2025-01-28T20:37:25.876359Z WARN bevy_cobweb_ui::loading::cob::sections::cob_scenes: encountered scene item that isn't aligned with other items in the same layer at file: mainmenu.cob, line: 19, column: 17; item indent: 16, expected: 12```
I am trying to align 4 buttons in a small dashboard for my menu. Here is my cob file
#scenes
"root"
AbsoluteNode{width: 100vw height: 100vh justify_main: SpaceEvenly justify_cross: Center }
BackgroundColor(#2C2F33)
"button_board"
AbsoluteGridNode{top: 45vh left: 37.5vw width: 25vw height: 45vh justify_cross: Center justify_main: Center}
BackgroundColor(#2F4F2F)
"grid_node"
GridNode{grid_auto_flow: Row row_gap: 8px grid_template_rows: [(Count(4) auto)]}
"button"
FlexNode{width: 20vw height: 10vh}
BackgroundColor(#D2691E)
"button2"
FlexNode{width: 20vw height: 10vh}
BackgroundColor(#00FF00)
"button3"
FlexNode{width: 20vw height: 10vh}
BackgroundColor(#FFFF00)
"button4"
FlexNode{width: 20vw height: 10vh}
BackgroundColor(#FFFFFF)
but the result is liek this. They are not centered
if I put justify_main: Center for my buttons they stay the same and I get this error.
and is there a way to use a value as a percentage of their parent?
The warning comes from this
GridNode{grid_auto_flow: Row row_gap: 8px grid_template_rows: [(Count(4) auto)]}
"button"
FlexNode{width: 20vw height: 10vh}
BackgroundColor(#D2691E)
"button2"
FlexNode{width: 20vw height: 10vh}
BackgroundColor(#00FF00)
"button3"
FlexNode{width: 20vw height: 10vh}
BackgroundColor(#FFFF00)
"button4"
FlexNode{width: 20vw height: 10vh}
BackgroundColor(#FFFFFF)
It should be
GridNode{grid_auto_flow: Row row_gap: 8px grid_template_rows: [(Count(4) auto)]}
"button"
FlexNode{width: 20vw height: 10vh}
BackgroundColor(#D2691E)
"button2"
FlexNode{width: 20vw height: 10vh}
BackgroundColor(#00FF00)
"button3"
FlexNode{width: 20vw height: 10vh}
BackgroundColor(#FFFF00)
"button4"
FlexNode{width: 20vw height: 10vh}
BackgroundColor(#FFFFFF)
For value as percent, use %
Aside from that, I am no expert on grid layout so you might need to ask in #ui
Unfortunately the CSS layout stuff is a significant barrier to UI productivity for non-web-devs
% wont take into account row gap causing resizing (currently only a concern for height). You will have to add margins or use grid auto row.
Have you tried the using the justify center options on the grid node itself.
Justify only works on a level below
I am trying to use max_content in cob https://docs.rs/bevy_cobweb_ui/latest/bevy_cobweb_ui/ui_bevy/enum.GridVal.html .
but I am not sure how to translate to COB
my attempt
"build_datum"
BuiltListUi
GridNode{ grid_auto_flow:Column width:75%
grid_template_columns:[auto] //Here have tried a few MaxConent, max_content maxcontent
justify_cross:Center}
"demolish"
BackgroundColor($colours::demolish)
"text"
TextLine{text:"Demolish" size:15 font:{family:"Iceland"}}
TextLineColor($colours::main_text)
"building"
TextLine{text:"Building name" font:{family:"Iceland"}}
TextLineColor($colours::main_text)
"count"
TextLine{text:"districts" size:15 font:{family:"Iceland"}}
TextLineColor($colours::main_text)
"workers"
TextLine{text:"workers" size:15 font:{family:"Iceland"}}
TextLineColor($colours::main_text)
Like Val but also accepts additional values for grid layouts.
MaxContent should work, whatโs the error?
serialization hint: GridNode{width:auto height:auto max_width:auto max_height:auto min_width:auto min_height:auto aspect_ratio:none border:{top:0px bottom:0px left:0px right:0px} top:auto bottom:auto left:auto right:auto clipping:None clip_margin:{visual_box:ContentBox margin:0} padding:{top:0px bottom:0px left:0px right:0px} justify_lines:FlexStart justify_main:FlexStart justify_cross:FlexStart column_gap:auto row_gap:auto grid_auto_flow:Row grid_auto_rows:[] grid_auto_columns:[] grid_template_rows:[] grid_template_columns:[] margin:{top:0px bottom:0px left:0px right:0px} justify_self_cross:Auto grid_row:{start:0 span:1 end:0} grid_column:{start:0 span:1 end:0}}
at /home/lyndonm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_cobweb_ui-0.11.2/src/loading/extract/reflected_loadable.rs:53
#import
cs as colours
planet as planets
#scenes
"buildings"
+planets::tab_title{
FlexNode{padding:{left:10px right:10px} justify_main:Center }
"text"
TextLine{text:"Buildings" size:30 font:{family:"Iceland"}}
}
"build_scene"
FlexNode{width:100% flex_direction:Column justify_self_cross:FlexStart justify_main:FlexStart justify_cross:Center column_gap:5%
margin:{bottom:10% top:5%}
}
"build_header_scene"
FlexNode{margin:{bottom:5%} width:100% flex_direction:Row justify_main:Center }
BackgroundColor($colours::outliner)
"text"
TextLine{text:"Buildings on planet" font:{family:"Iceland"}}
TextLineColor($colours::main_text)
"build_datum"
BuiltListUi
GridNode{ grid_auto_flow:Column width:75%
grid_template_columns:[MaxContent] // <--- Here
justify_cross:Center}
"demolish"
BackgroundColor($colours::demolish)
"text"
TextLine{text:"Demolish" size:15 font:{family:"Iceland"}}
TextLineColor($colours::main_text)
"building"
TextLine{text:"Building name" font:{family:"Iceland"}}
TextLineColor($colours::main_text)
"count"
TextLine{text:"districts" size:15 font:{family:"Iceland"}}
TextLineColor($colours::main_text)
"workers"
TextLine{text:"workers" size:15 font:{family:"Iceland"}}
TextLineColor($colours::main_text)
That does work
Ok I fix bug tomorrow
Thanks
Tomorrow = 6 days later. Fixed in 0.12.1 :)
Just looking at code here https://ukoehb.github.io/cobweb_book/tabs_cleanup.html
"exit"
FlexNode{justify_main:Center}
RadioButton
ControlRoot
Multi<Animated<BackgroundColor>>[
{
idle: Hsla{ hue:221 saturation:0.5 lightness:0.15 alpha:0.5 }
hover: Hsla{ hue:24 saturation:0.5 lightness:0.50 alpha:1.0 }
}
{
state: [Selected]
idle: Hsla{ hue:221 saturation:0.5 lightness:0.20 alpha:0.5 }
}
]
Multi<Animated<NodeShadow>>[
{
idle: {
color:Hsla{ hue:221 saturation:0.5 lightness:0.20 alpha:0.5 }
x_offset: 0px,
y_offset: 0px,
spread_radius: 1px,
blur_radius: 1px,
}
}
{
state: [Selected]
idle: {
color:Hsla{ hue:221 saturation:0.5 lightness:0.20 alpha:0.5 }
x_offset: 0px,
y_offset: 0px,
spread_radius: 10px,
blur_radius: 10px,
}
}
]
Is there a reason now shadow cannot be simplified to be like backgroundcolor?
Seems there is an extra object level
I don't know why I did it that way
It includes spread radius and blur radius and the offsets, not sure what you mean.
Oh yes sorry its very obvious now, the second case is grouping multiple attributes
Hey @ripe ice friendly poke for that animations tips and tricks :) if youโre still up for it
I am most definitely still up for it. Was thinking I would get the demo out for my game first beforehand since then you'd be able to really play around with some of the interfaces I've made. Would you mind pinging me around end of March? Aiming to get the demo out by then
Sounds good, looking forward to the demo!
Here's a quick draft, still working on it but lmk if you'd like me to talk about something in particular. https://massive-harbor-061.notion.site/Using-bevy_cobweb_ui-for-eased-animations-1b7fa06e3b978068ba91f918d214a71c
Saw your demo released, congrats! The trick you use for the menu opening transition where the camera seems to 'pan down' from looking at the sun is definitely cool and worth talking about.
In your draft I see you have pub fn item_box_hover_cosmetic<'a>(l: &mut LoadedScene<'a, UiBuilder<'a, Entity>>. Are you on an old version of cobweb ui? In latest you can just do pub fn item_box_hover_cosmetic(h: &mut UiSceneHandle.
Yeah still on an old version... I'll just add that into the draft
Let me write out a section on the menu transition... the menu is actually not done yet. I want to implement a layer parallax on it as well. That's for the future though.
Hi all! I'm trying on adding nodes inside a scroll view at runtime, and I referred to the book and the examples here and here provided to do it. However, the nodes are appearing outside the scroll view and are stacked. Am I doing something wrong? Here is the code:
#scenes
"body"
FlexNode{flex_direction:Column width:100% height:100%}
"scroll"
ScrollBase
FlexNode{width:100% height:100%}
BackgroundColor(#888888)
"view"
ScrollView
FlexNode{width:100% height:30% clipping:ScrollYClipX}
"foo"
FlexNode{justify_cross:Center}
"bar"
ScrollBar{axis:Y}
FlexNode{height:100% width:7px}
BackgroundColor(#888888)
"handle"
ScrollHandle
AbsoluteNode{width:100%}
BackgroundColor(#BBBBBB)
fn foo(mut commands: Commands, mut s: SceneBuilder){
commands
.ui_root()
.spawn_scene(("foo.cob", "body"), &mut s, |scene| {
for i in (0..=20).into_iter() {
scene.edit("scroll::view::foo", |e| {
e.spawn(Text2d::new(format!("{} {}", "Foo", i)));
});
}
});
}
โfooโ needs to be an AbsoluteNode, not FlexNode
And needs to have ScrollShim
I thought that ScrollShim was no longer necessary after Bevy 0.15.1, as you mentioned in scroll example
I need to update the crate to get rid of the shim (if possible).
Hi its been a while, I want to change the background colour of the earth node to be say green, based on a condition.
Is there a way to use states for general logic as opposed to something like selected, or should I just spawn a different scene?
Sure, just define a custom pseudostate then insert it when the condition is true and remove when false.
Think you can remove that todo!
Multi<Animated<NodeShadow>>[
{
idle:{
color:$colours::active_tab
x_offset: 0px,
y_offset: 0px,
spread_radius: 1px,
blur_radius: 1px,
}
}
{
state:[Selected] //Referring to this
idle:{
color:$colours::active_tab
x_offset: 0px,
y_offset: 0px,
spread_radius: 10px,
blur_radius: 10px,
}
}
]
``` instead of selected do I put `state:[Custom("colonised")]`
Answer is yes
It's already removed, are you looking at an old version of the repo?
from clicking source here
https://docs.rs/bevy_cobweb_ui/latest/bevy_cobweb_ui/sickle/enum.PseudoState.html
API documentation for the Rust PseudoState enum in crate bevy_cobweb_ui.
Source of the Rust file src/attributes/pseudo_state.rs.
Ah not published yet
I finally got it to work. With ScrollShim keeps appear outside if I use spawn(). So, I created a simple scene with the text and used spawn_scene(), and now it appears inside the scroll. It's odd that it seems to only works this way, though.
How did you call spawn() exactly? It's possible you spawned the text as a root UI node instead of as a child of the shim.
Here, I spawn text within ScrollShim. With these modifications here, it shows as expected within ScrollShim:
#scenes
"body"
FlexNode{flex_direction:Column width:100% height:100%}
"scroll"
ScrollBase
FlexNode{width:100% height:100%}
BackgroundColor(#888888)
"view"
ScrollView
FlexNode{width:100% height:30% clipping:ScrollYClipX}
"foo"
ScrollShim
AbsoluteNode{width:100% justify_cross:FlexStart justify_main:FlexStart flex_direction:Column}
... # Same as before
"bar"
"text"
TextLine{text:""}
TextLineColor(#ffffff)
fn foo(mut commands: Commands, mut s: SceneBuilder){
commands
.ui_root()
.spawn_scene(("foo.cob", "body::"), &mut s, |scene| {
scene.edit("scroll::view::foo", |scene| {
for i in (0..=20).into_iter() {
scene.spawn_scene(("foo.cob", "bar"), |scene_handle| {
scene_handle
.get("text")
.update_text(format!("{} {}", "Foo", i));
});
}
});
}
The thing that seems strange to me, is that if I use spawn() instead of spawn_scene() to do it easier, the text keeps appearing outside, as if it does not follow the style
This will spawn the text as children of "body". Use scene.get("scroll::view::foo") to get the shim node for spawning text.
Right, I edited the code in the first message and forgot to put spawn.edit("scroll::view::foo"...) line ๐
Ah ok. Were you calling scene.spawn(Text(...))? That should spawn the text as a child of foo.
I removed it for scene.spawn_scene(...) because when using scene.spawn(Text(...)), it appears like this (Text is in the bottom right):
Instead, using this spawn_scene as here, comes out like this
.
They look like children of "body", although it's weird to see them overlapping and in the lower right.
Idk, by now I have adapted to this and for what I want to do it might be the best thing, you can add this issue to the things to be fixed
Anyway, thank you for clarifying this here, it may be useful for posterity to see this discussion
I will try to reproduce it
Looks like the problem occurs if you're missing the default_font bevy feature.
Hello,
In my game, I have two cameras:
The UI camera:
commands.spawn((
Name::new("UI Camera"),
Camera2d,
// Render all UI to this camera.
IsDefaultUiCamera,
RenderLayers::layer(UI_RENDER_LAYER),
Camera {
// Bump the order to render on top of the gameplay cam.
order: 1,
..default()
},
));
the 3D World camera:
commands.spawn((
Name::new("WorldModelCamera"),
Camera3d::default(),
Projection::from(PerspectiveProjection {
fov: 90.0_f32.to_radians(),
..default()
}),
));
How can I add RenderLayers::layer(UI_RENDER_LAYER), to all my UI nodes ?
My UI scenes are written in .cob
There is no built-in way to do it. You could add a marker component to the root node of each UI hierarchy, then add a system that polls for Added<YourMarker> and traverses the UI hierarchy adding RenderLayers components to each ui node.
The marker component can be registered for cob files with app.register_component_type::<YourMarker>().
Thank you for your reply. I also thought about this solution, however, I'm not sure how you can traverse the UI hierarchy
Just query Query<(Entity, Option<&Children>), With<Node>> then write a function to recursively access child nodes.
@twin quail Hello. Is there a way to see all the loadables? Im new and it is kind of confusing for me.
Hmm there's no way right now. This lists out instructions implemented by the crate: https://docs.rs/bevy_cobweb_ui/0.12.2/bevy_cobweb_ui/loading/trait.Instruction.html#implementors but it doesn't include pure component loadables and commands.
Okay thanks. I will check it.
I will add it to my todo list to be able to get the full list of registered loadables.
I want to make a simple menu with buttons but I dont know what loadable I need to use.
I tried GridNode and the blue boxes are the result.
The red outlines are what I want to do.
#scenes
"menu"
FlexNode{width:100% height:100% flex_direction:Column justify_main:Center justify_cross:Center}
"button"
FlexNode{margin:{top:10px}}
BackgroundColor(#ABCDEF)
"text"
FlexNode{margin:{top:10px bottom:10px left:7px right:7px}
TextLine
Then in-code spawn "menu" as a root scene, edit it and spawn each button separately as children of the "menu" node. Check the radio_buttons example: https://github.com/UkoeHB/bevy_cobweb_ui/tree/main/examples/radio_buttons
You'll also have the edit the button "text" nodes to set the text for each button.
The example shows how to do that.
Branch bevyrc is updated to bevy v0.16.0-rc.5
Published v0.12.3 to add the .cobweb file extension as an option if COBOL is causing conflicts in your environment.
Lol who is using cobol and rust
Not that it is a bad thing adding support just the scenario amuses me
No one, but some environments auto-detect COBOL. Such as github
Oh thanks that makes sense.
@twin quail Hi.
I did as you mentioned. The result is like this but how can I make all 4 of them automatically shrink or flex to have exactly 4 buttons with margins?
Can you explain in more detail what you want to do?
I want to recreate this simple layout.
When I try the example you mentinoed. The buttons are small.
Here, the bottom buttons are small. The first button I set it's width and height.
Make an outer node to contain all the buttons (don't set width, but you can set min_width). Then in each button set min_width:100%. All the buttons will stretch to have the same width.
Btw for you neovim users out there, FabricSoul added syntax highlighting: https://github.com/FabricSoul/tree-sitter-cobweb
I think that could work for Helix as well
Yeah anything using tree sitter
@twin quail I managed to do it like this.
#defs
$buttoncolor = #ff0000
+mainmenubutton = \
FlexNode{flex_grow: 1 margin:{top:5px bottom: 5px} width: 90% justify_main: Center justify_cross: Center}
\
#scenes
"mainmenu"
AbsoluteNode{width: 100% height: 100%}
BackgroundColor(#1e1e2e)
"text"
AbsoluteNode{top:40% left:45%}
TextLine{text:"Simuverse"}
"dashboard"
FlexNode{left: 40% top: 55% width: 20% height: 40% flex_direction: Column justify_main: Center justify_cross: Center padding:{top: 5px bottom: 5px}}
BackgroundColor(#2a2b3d)
"play"
+mainmenubutton{}
BackgroundColor($buttoncolor)
"text"
FlexNode{margin: {top:10px bottom:10px left: 7px right: 7px}}
TextLine{text:"BUTTON"}
"play"
+mainmenubutton{}
BackgroundColor($buttoncolor)
"text"
FlexNode{margin: {top:10px bottom:10px left: 7px right: 7px}}
TextLine{text:"BUTTON"}
"options"
+mainmenubutton{}
BackgroundColor($buttoncolor)
"text"
FlexNode{margin: {top:10px bottom:10px left: 7px right: 7px}}
TextLine{text:"BUTTON"}
"quit"
+mainmenubutton{}
BackgroundColor($buttoncolor)
"text"
FlexNode{margin: {top:10px bottom:10px left: 7px right: 7px}}
TextLine{text:"BUTTON"}
Nice
Published bevy_cobweb v0.17 and bevy_cobweb_ui v0.13 with bevy 0.16 support.
at /home/lyndonm/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_cobweb_ui-0.12.3/src/loading/cob/data/cob_file.rs:56
WARN bevy_cobweb_ui::loading::cob::cob: incomplete COB file parsing, error at file: ui/manifest.cobweb, line: 2, column: 1```
```rust
#manifest
"ui/colour_scheme.cobweb" as cs
"ui/buttons.cobweb" as btns
"ui/planets/planet.cobweb" as planet
#commands
RegisterFontFamilies[
{
family: "Iceland"
fonts: [
{
path: "fonts/Iceland-Regular.ttf"
width: Normal style: Normal weight: Normal
}
]
}
]
LoadFonts["Iceland"] // <-- required to actually use the font family! Also see LoadLocalizedFonts.
Is this a bug? I am still on 0.15 as not all my plugins have updated
Looked at latest code looks like that 0.13 will work but I am stuck on 0.12.
Is it easy to fix and publish, otherwise I can just rename in the interm
Should work if you do cargo update
I am on 0.12.3
@twin quail Hello, is it possible to register an enum component like the example below?
#[derive(Component, Debug, Clone, Copy, PartialEq, Reflect)]
pub enum MainmenuButtonAction {
Singleplayer,
Multiplayer,
Options,
Exit,
}
it gives out an error like this
| ^^^^^^^^ required by this bound in `CobLoadableRegistrationAppExt::register_component```
error[E0277]: the trait bound `MainmenuButtonAction: bevy_cobweb_ui::loading::Loadable` is not satisfied
--> src\uimanager\mainmenu.rs:11:40
|
11 | .register_component_type::<MainmenuButtonAction>()
| ----------------------- ^^^^^^^^^^^^^^^^^^^^ the trait `std::default::Default` is not implemented for `MainmenuButtonAction`
| |
| required by a bound introduced by this call
|
= note: required for `MainmenuButtonAction` to implement `bevy_cobweb_ui::loading::Loadable```
Sure, just derive Default
Yeah it worked. Thanks.
I will publish a patch fix for v12 and v13. Should be done in 30mins.
Thanks appreciate it
Is there a way to deal with input fields in cobweb? I'm designing a chatbox ui but don't see that capability, do we need a separate crate?
There is no built-in input widget yet. Would be awesome to have one, but they are a ton of work to get right and I am focused on other things. Cobweb is bevy_ui under the hood so if you find another text input implementation, it will be compatible with cobweb.
Thank you very much for that info and I completely understand. I appreciate that, it puts me in the right direction, I didn't want to overlook something obvious in case I missed it ๐ I'll investigate for a while longer.
The bevy_simple_text_input and bevy_ui_text_input crates are prominent options.
For doing that would I maybe add a marker component to the node I want to inject the text input field into and then query for that so I can set it as a child? I am a little unsure how to access the nodes hierarchy from the .cob structure.
There are two approaches:
- Access the cob structure directly and insert the text input to the appropriate node. No marker component required.
- Write a custom cob instruction that will auto-insert a text input to cob nodes.
For accessing nodes, check the repo examples: https://github.com/UkoeHB/bevy_cobweb_ui/blob/1a1208a41c3747f48a2278166dbe7c67b91fc9c7/examples/checkbox/src/main.rs#L10.
For writing instructions, see these docs (the Loadable values subsection): https://docs.rs/bevy_cobweb_ui/latest/bevy_cobweb_ui/loading/index.html#scenes-section.
That worked perfectly and now I understand the api much better! I super appreciate the tips ๐
Publishing v0.13.4 to fix a compile error on WASM. Note that CustomCursorUrl is broken until bevy v0.16.1.
Published v0.1.4.0 with default font control: https://github.com/UkoeHB/bevy_cobweb_ui/blob/main/CHANGELOG.md#0140
I think more of a rust problem, sorry going to be multiple posts due to charcter limit.
fn setup_panels(
all_goods: Res<GoodsRepository>,
mut commands: Commands,
mut scene_loader: SceneBuilder,
) {
//snip tracing
let scene = SceneRef::new("ui/panels/political_panel.cobweb", "political_panel_scene");
commands
.ui_builder(UiRoot)
.spawn_scene(scene, &mut scene_loader, |scene_handle| {
let mut companies = scene_handle.get("menus::companies");
companies.on_pressed(|mut commands: Commands, mut scene_builder: SceneBuilder| {
let scene = SceneRef::new("ui/panels/political_panel.cobweb", "companies_popup");
commands
.ui_root()
.spawn_scene(scene, &mut scene_builder, |scene_handle| {
let popup_entity = scene_handle.id();
scene_handle.update_on(
broadcast::<PrivateCompaniesUpdate>(),
move |id: TargetId,
mut commands: Commands,
scene_builder: SceneBuilder,
companies: Res<CompanyRepository>| {
let private_company_popup = scene_handle;
for c in &companies {
private_company_popup
.spawn_scene(&mut scene_builder, |scene_handle| {});
}
},
);
});
});
});
//snip
I get a recursion error unless I uncomment out the for loop, I have no idea why?
Context is I am trying to fill in rows in the table
To be something like this
error[E0275]: overflow evaluating the requirement `&_: IntoIterator`
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`pronytic_ui`)
= note: required for `&bevy::prelude::Res<'_, _>` to implement `IntoIterator`
= note: 126 redundant requirements hidden
= note: required for `&Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, ...>>>>>>>>>>>>>>>>>>>>` to implement `IntoIterator`
= note: the full name for the type has been written to '/home/lyndonm/Programming/pronytic/target/debug/deps/pronytic_ui-ea1ad4864b18c28c.long-type-17841256814943190798.txt'
= note: consider using `--verbose` to print the full type name to the console
For more information about this error, try `rustc --explain E0275`.
error: could not compile `pronytic-ui` (lib) due to 1 previous error
Maybe do companies.iter() instead of &companies.
Presumably it's CompanyRepository(Vec<Company>) or something, and implements Deref?
Yes its a hashmap
Compiling pronytic-ui v0.1.0 (/home/lyndonm/Programming/pronytic/pronytic-ui)
error[E0277]: the trait bound `bevy_cobweb_ui::loading::SceneRef: From<&mut bevy_cobweb_ui::loading::SceneBuilder<'_>>` is not satisfied
--> pronytic-ui/src/panel.rs:137:54
|
137 | ... .spawn_scene(&mut scene_builder, |scene_handle| {});
| ----------- ^^^^^^^^^^^^^^^^^^ the trait `From<&mut bevy_cobweb_ui::loading::SceneBuilder<'_>>` is not implemented for `bevy_cobweb_ui::loading::SceneRef`
| |
| required by a bound introduced by this call
|
= help: the trait `From<&mut bevy_cobweb_ui::loading::SceneBuilder<'_>>` is not implemented for `bevy_cobweb_ui::loading::SceneRef`
but trait `From<(_, _)>` is implemented for it
= help: for that trait implementation, expected `(_, _)`, found `&mut bevy_cobweb_ui::loading::SceneBuilder<'_>`
= note: required for `&mut bevy_cobweb_ui::loading::SceneBuilder<'_>` to implement `Into<bevy_cobweb_ui::loading::SceneRef>`
note: required by a bound in `SceneHandle::<'a, T>::spawn_scene`
--> /home/lyndonm/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_cobweb_ui-0.12.4/src/loading/scene/spawn_scene_ext.rs:297:52
|
297 | pub fn spawn_scene<C, R>(&mut self, path: impl Into<SceneRef>, callback: C) -> &mut Self
| ^^^^^^^^^^^^^^ required by this bound in `SceneHandle::<'a, T>::spawn_scene`
sorry btree
#[derive(Default, Debug, Deref, DerefMut, Resource)]
pub struct CompanyRepository {
pub map: BTreeMap<u16, Company>,
}
Yes, do companies.iter(). &companies gives you a reference to Res<...> which can't be iterated.
You need to use commands.ui_builder(popup_entity).spawn_scene(scene, &mut s).
Or the TargetId. It's the same entity.
sorry got lost somewhere.
commands
.ui_builder(UiRoot)
.spawn_scene(scene, &mut scene_loader, |scene_handle| {
let mut companies = scene_handle.get("menus::companies");
companies.on_pressed(|mut commands: Commands, mut scene_builder: SceneBuilder| {
let scene = SceneRef::new("ui/panels/political_panel.cobweb", "companies_popup");
commands
.ui_root()
.spawn_scene(scene, &mut scene_builder, |scene_handle| {
let popup_entity = scene_handle.id();
scene_handle.update_on(
broadcast::<PrivateCompaniesUpdate>(),
move |id: TargetId,
mut commands: Commands,
scene_builder: SceneBuilder,
companies: Res<CompanyRepository>| {
for c in companies.iter() {
commands.ui_builder(id).spawn_scene(
(
"ui/panels/political_panel.cobweb",
"companies_datum_popup",
),
&mut scene_builder,
|scene_handle| {},
);
}
},
);
});
});
});
warning: `pronytic-private-sector` (lib) generated 3 warnings
Compiling pronytic-ui v0.1.0 (/home/lyndonm/Programming/pronytic/pronytic-ui)
error[E0599]: the method `spawn_scene` exists for struct `UiBuilder<'_, TargetId>`, but its trait bounds were not satisfied
--> pronytic-ui/src/panel.rs:136:61
|
136 | ... commands.ui_builder(id).spawn_scene(
| ------------------------^^^^^^^^^^^ method cannot be called on `UiBuilder<'_, TargetId>` due to unsatisfied trait bounds
|
::: /home/lyndonm/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cob_sickle_ui_scaffold-0.6.0/src/ui_builder.rs:28:1
|
28 | pub struct UiBuilder<'a, T>
| --------------------------- doesn't satisfy `_: SceneNodeBuilder` or `_: SpawnSceneExt`
|
= note: the following trait bounds were not satisfied:
`bevy_cobweb_ui::sickle::UiBuilder<'_, bevy_cobweb_ui::react_ext::TargetId>: SceneNodeBuilder`
which is required by `bevy_cobweb_ui::sickle::UiBuilder<'_, bevy_cobweb_ui::react_ext::TargetId>: bevy_cobweb_ui::loading::SpawnSceneExt`
You need to dereference the id: .ui_builder(*id) to get UiBuilder<Entity>.
Published v0.14.1 to fix a compile bug and add some internal optimizations.
Published v0.14.2 to fix hot reloading causing nodes to disappear temporarily.
Published v0.14.3 with SetTextShadow loadable.
Published v0.14.4 with a bugfix for windows.
Sorry whats the syntax for Vectors in cobweb files.
TextShadow{
offset:[5px 10px]
color:#AA0000
}
Tried a few variations all of them have failed
You want tuple of int: (5 10)
And TextShadow isnโt a loadable. Use SetTextShadow
Thanks
try
.add_systems(OnEnter(LoadState::Done), build_ui)
That fixed it, did not realize it was a built in LoadState hehe. Thanks a bunch!
There is no built-in widget for those. But you can build your own or integrate with a third-party crate.
is it possible to integrate it with cobweb ui ?
Im fairly new and I dont even know how to "integrate" it with a third party crate but I will look into it.
Yes, cobweb ui is just a layer over bevy ui so any bevy ui widget will work.
is there an example within cobweb ui that I can study with?
Not exactly, but bevy ui widgets are usually just spawning a node hierarchy as a child of an existing node, or adding funcationality to existing nodes. So with cobweb ui you can spawn a normal UI scene, then access the child node where you want your widget (the examples show how to do this), then spawn the widget (or insert its components) on that child.
Here are some text input crates:
I will add if you want more then one textbox at a time I would avoid simple text input as last time I tried editing one edited all
If I'm super new to bevy do you recommend I use cobweb_ui or just use the existing bevy ui system?
I think its as easy to start with,
I would try out first few chapters in book https://ukoehb.github.io/cobweb_book/.
See if you like it or not will only take 15 minutes.
Happy to answer questions here
I have a question
I want to display the players score using a .cob file, I have a Resource that records the players score, I'm not sure how to update a scene without simply spawning it again.
use bevy::prelude::*;
use bevy::time::*;
use bevy_cobweb_ui::prelude::*;
use std::time::Duration;
#[derive(Resource, Default)]
struct Score(u32);
pub struct UiPlugin;
impl Plugin for UiPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<Score>();
app.add_systems(OnEnter(LoadState::Done), setup_ui);
app.add_systems(
Update,
update_ui.run_if(common_conditions::on_timer(Duration::from_millis(500))),
);
app.load("ui.cob");
}
}
fn setup_ui(mut cmd: Commands, mut s: SceneBuilder, mut score: ResMut<Score>) {
score.0 = 10;
cmd.ui_root()
.spawn_scene(("ui.cob", "main_scene"), &mut s, |scene_handle| {
scene_handle.update_text(score.0.to_string());
});
}
fn update_ui(mut score: ResMut<Score>) {
score.0 += 1;
// how do I update the "main_scene" in ui.cob?
println!("{}", score.0);
}
Help is appreciated ๐
I can think of 2 options.
- Putting a component on each text and querying it like you woud on bevy.
- Adding reactivity via the
bevy_cobweb(you are usingbevy_coweb_uicrate.
I will am working on option 2 atm will post when I have it, shouldn't be too hard
use bevy::prelude::*;
use bevy::time::*;
use bevy_cobweb::prelude::*;
use bevy_cobweb_ui::prelude::*;
use std::time::Duration;
#[derive(Resource, Default)]
struct Score(u32);
pub struct UiPlugin;
pub struct ScoreUpdate;
impl Plugin for UiPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<Score>();
app.add_systems(OnEnter(LoadState::Done), setup_ui);
app.add_systems(
Update,
update_ui.run_if(common_conditions::on_timer(Duration::from_millis(500))),
);
app.load("ui.cob");
}
}
// fn main() {
// App::new()
// .add_plugins(DefaultPlugins)
// .add_plugins(UiPlugin)
// .run();
// }
fn setup_ui(mut cmd: Commands, mut s: SceneBuilder, mut score: ResMut<Score>) {
score.0 = 10;
cmd.ui_root()
.spawn_scene(("ui.cob", "main_scene"), &mut s, |scene_handle| {
scene_handle.update_on(
broadcast::<ScoreUpdate>(),
move |id: TargetId, mut editor: TextEditor, score: Res<Score>| {
write_text!(editor, *id, "{}", score.0);
},
);
scene_handle.update_text(score.0.to_string());
});
}
fn update_ui(mut score: ResMut<Score>, mut cmd: Commands) {
score.0 += 1;
// how do I update the "main_scene" in ui.cob?
cmd.react().broadcast(ScoreUpdate);
println!("{}", score.0);
}
My ide was refusing to give me suggestions so that slowed me down, not 100% sure the syntax is correct but try this
remember to add bevy_cobweb
Basically whenever you update the score, you broadcast a signal to cobweb to update, the update_on after the text editor can contain any valid system parameters.
I am not 100% sure this is the best way will have to wait for Koe to confirm
It works!
I'll look more into broadasting, it seems very helpful
thanks for the help :)
I should add an example like that to the book one day.
Yep this will work, or you can use a ReactResource from bevy_cobweb, then update_on(resource_mutation::<Score>()
Or you could broadcast a global event every tick, and update the score text on that event. Should be similar perf cost to running a system every tick.
Nice never mutated resources so I never needed that.
Published v0.15.0 which moves the cob definition to a separate crate cobweb_asset_format. The goal is to allow raw asset files to be parsable with the cob format without bevy_cobweb_ui as a dependency (I plan to replace TOML with raw cob in my game's server configs).
If itโs raw is it still the cob format.
My understanding this is using bytes not text.
Well not raw bytes, you need to read bytes to a string before parsing. For example you could have:
{
"a":1
"b":2
}
In a file, then parse that into a CobValue, then extract keys and values from the map that is parsed.
Nice looking forward to it!
Not sure if this is a cobweb thing, but when I changed text colour and hot reloadingI have noticed text disappering, resizing seems to fix.
Update the crate, there was a bug.
I just updated to 0.16 I am still getting that bug
Hmm ok will investigate
Its not happening will all my text
for example it happens on "Dwarf Planets" but not "Pluto" or "Eris"
Do Pluto and Eris have FlexNode?
The bug is caused by removing Node and its required components during a hot reload of a node. I fixed it for FlexNode but not for text stuff.
GridNode{ margin:{bottom:$row_gap}},
"title"
TextLine{text:"Dwarf Planets" font:{family:"Iceland"}}
TextLineColor($colours::dwarf_title_text)
"dwarf_item_scene"
FlexNode{
margin:{left:20px}
}
TextLine{text:"dwarf" size:20.0 font:{family:"Iceland"}}
TextLineColor($colours::dwarf_item_text)
Multi<Animated<BackgroundColor>>[
{
state:[Custom("Colonised")]
idle:$colours::colonised_outliner
}
]
Yes it does, so would the grid node be causing this?
Pluto and Eris are instances of dwarf_item_scene
Yeah dwarf_scene::text doesn't have any *Node loadables. I will fix this, should be done in 15mins.
Thanks greatly appreciated
I just used the example for scoreboard, I am getting denied permission
If this is intended I will fork and do the pull request thing tomorrow
You are trying to push main as a new branch, but main already exists.
hello, i wanted to ask how easy is it to do responsive ui in cobweb? i need something that i can use for applications, for example if screen width is less then 512px then different style should apply, usually in websites its bg-red md:bg-green so background is red by default but if screen reaches pre-defined medium-display size then background will be green
Hey, yes it's possible. Use something like:
"my_node"
Multi<Static<Width>>[
{value:200px}
{state:[Custom("MediumDisplay")] value:150px}
]
Then either manually add/remove the "MediumDisplay" custom PseudoState from the node (see the PseudoStateParam system param), or add a marker component to all the nodes that should respond to display size changes and use a system to add/remove pseudostates automatically (this is what I plan to do for my project if I ever go mobile).
oh thx a lot, this is exactly what i needed โฅ๏ธ
i will try it
All the node field instructions are here: https://docs.rs/bevy_cobweb_ui/latest/bevy_cobweb_ui/ui_bevy/index.html
good to know, i havent played much with cobweb yet >:3 the default bevy ui creation is horrific XD
I learnt how to do ssh so I pushed the changes, (I forgot to commit them earlier lol).
looks like CI needs updating
I updated it to 24.04, now my new section of the book is live
Just published v0.17.0 which adds TextShadowGroup and TextOutline loadables. The text outline impl is kind of brute force, so it may not be performant with large outline widths. But otherwise it gives quite nice outlines.
Published v0.18.0 which adds simple anti-aliasing to TextOutline.
How would you load images in cobweb?
I am starting to replace text with icons!
Thanks, should have looked there, I thought it would be more akin to fonts
Published v0.19.0 with default color for text outlines (black) and a perf improvement for text outlines.
Published v0.20.0, which moves text outlines to the bevy_slow_text_outline crate and re-exports them. No changes are needed, but now outlines are capped at 8 pixels (after scaling).
Published v0.21.0, which moves the core loading functionality to a sub-crate bevy_cobweb_ui_core. The sub-crate can be used directly if you want to load COB files without all the extra UI stuff (e.g. for just commands, or for non-bevy_ui scenes).
Is there a cobweb specific way to load ui near the mouse or should I just ask in the ui channel?
Cobweb ui doesnโt have anything for that.
Thank you
let window = r!(window_query.single());
let cursor = r!(window.cursor_position());
commands.ui_builder(UiRoot).spawn_scene(
(file, "planet_orders"),
&mut scene_builder,
|loaded_scene| {
loaded_scene.style_inplace(|ui| {
ui.left(Val::Px(cursor.x));
ui.top(Val::Px(cursor.y));
});
Looked into it and turns out sickle does make it easier
Nice
Are radiogroup global?
I am having a problem when I click homstead in the top left, it also selects Homestead without deselecting urban.
If I click info it will deselect homestead.
The controlroot that holds Info, Buildings and census is a sibling of the desingation tab window
Sorry i mean radiogroup not control group
Radio groups are not global, I'm guessing there's some problem with your node structure.
Both children "Urban" and "Homestead" have RadioButtonHandlers the parent header has a RadioButtonManager.
This seems identical to my other set of working tabs. I am stumped, I think I will have to patch cobweb and start debugging from there.
Found the problem
scene_handle.on_select(move |mut commands: Commands| {
let mut tabs = commands.ui_builder(tabs_section_entity);
let desc = description.clone();
tabs.insert(Name::new("tab_section"));
tabs.update_text(desc);
});
if idx == 0 {
scene_handle
.entity_commands()
.add_pseudo_state(PseudoState::Selected);
}
});
if idx == 0 {
let entity = scene_handle.id();
scene_handle.react().entity_event(entity, Select);
}
Should start with select this way
It's happening again ๐
scene_handle.edit("grid::categories::headers",|scene_handle|{
let all_tab = scene_handle.spawn_scene((file,"tab"), |scene_handle|{
scene_handle.get("text").update_text("All");
});
all_tab.on_select(||{
info!("selected");
});
all_tab.on_deselect(||{
info!("deselect");
});
let entity = all_tab.id();
scene_handle.spawn_scene((file,"tab"), |scene_handle|{
scene_handle.get("text").update_text("test");
});
scene_handle.commands().react().entity_event(entity, Select);
});
I do get the logged message of select and when I click it seems to work.
I buried it deeper and it's working thank you 
scene_handle.edit("grid::categories::headers",|scene_handle|{
let all_tab = scene_handle.spawn_scene((file,"tab"), |scene_handle|{
scene_handle.get("text").update_text("All");
let entity = scene_handle.id();
scene_handle.commands().react().entity_event(entity,Select);
});
all_tab.on_select(||{
info!("selected");
});
all_tab.on_deselect(||{
info!("deselect");
});
let entity = all_tab.id();
scene_handle.spawn_scene((file,"tab"), |scene_handle|{
scene_handle.get("text").update_text("test");
});
scene_handle.commands().react().entity_event(entity,Select);
});
I am guessing just the display of text wasn't propogated down
I have looked at doing the migrations.
bevy_cobweb has some changes to deal with the fact some systems now do results, I am not sure how you would like to handle it.
bevy_cobweb_ui looks like it's only breaking in that it doesn't have lerp, ctrl f on docs did not return any results for lerp
Oh lerp doesn't seem to have anything to do with 0.17
Main problem I expect will be UiTransform/UiGlobalTransform.
I will try to get to updates this week/weekend.
Thank you, no hurry on my account at least, other plugins will be slower to update anyway.
I just looked to see if I could trivally help
Oh also if you are able to I would like if this was able to print the actual entity.
It's been in my code for 6 months but had no perfomance issues
WARN bevy_cobweb::react::utils: more than 50 reactors were registered targeting an entity, which may impact performance; consider using a resource for 'reaction hubs' instead; this warning only prints once
at /home/lyndonm/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_cobweb-0.17.2/src/react/utils.rs:67
I had a second look at migrating cobweb_ui (only for a hacky 0.17 no new features) and unfortunately I ran into a serious case of skill issue.
I see that you no longer plan on supporting your Bevy libraries end of the year, which is all good and understandable.
I am grateful that cobweb was around I would still stick with it over BSN ๐ .
My plan is move to 0.17 and use the BSN fork.
Are there still plans to migrate to 0.17 or should I start migrating my UI to plain Bevy?
I will update to 0.17 this week. It will be the last update to my crates, sorry for the delay.
Thank you, no problem you donโt owe me anything!
Updated to 0.22.0
Thank you greatly appreciated!
Are you still using bevy?
Only thing to watch out for is BorderColor is no longer a newtype. Use Splat<BorderColor>(color) instead in cob files.
Yes I tentatively plan to finish my project prototype. Took a long health break.
Hope all is well,
If we donโt talk again wish you all the best for your project!
Likewise :)
Fixed in 0.18.1. Use cargo update if it doesn't change.
Hey all, not planning to update this crate to bevy 0.18 since it's past the end of 2025 (at the beginning of the year I said no guarantees past end of year). If anyone is interested in becoming maintainer, send me a message or just fork it :).
Understandable, are you planning to update the readme to say no update is planned?
Also thanks for getting it to 0.17.
Being able to use some 0.17 widgets while migrating away has made my life easier.
I will do so
How has the migration gone?
Released 0.22.2 with the updated readme
I have only started with buttons two days ago.
I am having trouble understanding why the activate event is not triggering but it's easy to work around.
#ui message
I have also started making a compatibility layer for converting triggers to broadcasts, until I update the update_on method, for all uses.
/// Converts observer to broadcast, this is to maintain compatability with bevy_cobweb until it is removed
fn production_refresh_broadcast(_: On<ProductionRefresh>, mut commands: Commands) {
commands.react().broadcast(ProductionRefresh);
}
I think radio buttons will be the more challenging migration.
I plan on sticking with 0.17 at least until I have done a few more pop up menus that I currently have planned, being able to paste from my existing solutions and check it is working is too useful to let it go.
I don't think 0.18 has anything I feel I need to get straight away, I was awaiting for 0.17 for UiGlobalTransform and that turned out to not be suitable for me.
I also got caught out by justify_main and justify_cross not being a thing in bevy_ui.
The biggest problem I was having with cobweb is that when your closures get too deep rust formatter breaks, I was going to work around it by turning them into top level functions, which the migration is forcing me to do anyway.
I have found that I am using a lot more marker components
This question here is as a result of my issues with marker components for UI but solution is good enough
#ecs message
I had hoped to go straight to BSN but I think doing bevy_cobweb straight to BSN had a good chance of breaking stuff.
All in all not painful, cobweb's iteration speed has already served it's purpose so fixing the colours now is not that big of a deal.
Also nodeshadow being a different name but I learnt how to read cobwebs documentation and figured it out without much issue
Hah yeah JustifyContent/AlignContent/AlignSelf from flexbox are so asinine.
Glad to hear you're able to gradually switch over. Big benefit of both being bevy_ui.
Re: nodeshadow rename, it was needed to add #[reflect(default)] to the fields so you don't need to include all of them in every single instance in cob files.
In regards to my attempts to update myself, the trickiest things I found.
- I have never used Serde, I have watched a video explaining it but not needed it before.
- My favoured parser is lalrpop, which is quite different from Nom, as it's not a parser combinator
- Macros, I have never really needed them except for one occasion, I am comfortable with Regex so I don't think the syntax is in my way.
- The bevy stuff you use is beyond my needs, I have never needed unsafe.
I could overcome one of those at a time, but to overcome all of them at the same time for an existing project is too much for me.
Also reflect, I have only ever really derived it never used it.
If I wanted something like cobweb in future I think I would be better starting from scratch to use bevy's built in widgets rather then sickles
Also I have created my games data based very heavily on cobwebs syntax, I hope you see the similarities ๐
Honestly all the macros could be deleted/replaced, they are not essential. The serde/nom stuff is all stable/mature and shouldn't need touching (unless you want to add something like function callbacks, then it requires expertise). There is only one unsafe in cobweb_ui and it's buried deep, and one other deep in bevy_cobweb.
There's a little reflect between cob files and rust but not a ton (the ReflectedLoadable internal type) (an editor would require a lot more).
All the widgets are custom-built, nothing from sickle_ui is used (aside from pieces of the responsiveness/animation framework). I'd expect bevy widgets to be compatible with cobweb widgets, since it's all bevy_ui.
Very clean :) I like it
I remember looking at those items and not having a clue.
Even if I find I can migrate to 0.18 I am happy to seperate my buttons now.
But yeah, all that is just me defending the big project that I'm proud of :). Realistically, with BSN and editor supposedly on the (distant) horizon, as time passes it will become increasingly obsolete.
Yeah that whole thing is a huge pain, it can be deleted.
Building from scratch would be not be me thinking the project isn't good enough ๐ just I would need to do it to get the requisite knowledge.
The sickle macro. That bit in the editor directory is editor nonsense - heavy on reflect but not needed by the library (the editor is just a demo and is separate).
Are you going to migrate to another framework?
I'm moving on from Bevy to do other things. Much more into building libraries than writing games, as it happens.
Currently a little obsessed with Leek Wars, then on to employment (probably crypto stuff again).
I am opposite I like building for the user rather then other devs, I feel I can reason about needs much better.
I looked at other hot reloading and they are CSS based as I see it, none them quite have that self contained logic I like about cobweb.
I don't understand web dev or web devs. It all looks so ugly and opaque...
I like that I can see my main menu button, and reason about it, other then maybe one or two macros
cobweb_web when?
No way haha, don't curse me
My little brother (11) is like that, he has the right instinct/drive for game dev (he likes making Scratch games).
A couple weeks ago he said he likes using messages (events). Ah he's growing, I thought lol
Nice, I am not sure I have right instinct for games.
But for a previous job, I see users use an ordering system and got to the same 3 menus for checking one item and go why don't we make a menu for that case.
Or when they key in doors, they select glass design then get asked if they need bushfire resistance (Australia) a menu will say sorry this glass design is not bushfire resistant , I would change it so we ask about bushfire resistance first.
Yeah I remember feeling the same about events and you warned me about spaghetti code
Actually that was run system cached
They are very convenient, until they spiral into a confusing mess lol
Also he is fortunate to be able to start young, I didn't know what programming was until I turned 17 and had no one to ask.
Yeah I didn't really learn much until age ~24, decided to teach myself C++.
C++, I am so sorry
I liked it well enough :) but now I've done Rust for three years and see C++'s weaknesses.
Finally moved away from cobweb_ui buttons.
I did some other stuff but the migration did take a while.
I plan on removing all my cobweb broadcasts.
I will still use cobweb as I want to create something like this before migrating to 0.18.
It's an upgrade on the construction blueprints on the side, as it's very information deficient
TODO list.
- Convert broadcasts to observers, basically how my panels are update.
I will skip the radiobuttons for now - Convert the radio buttons.
- Create that construction outliner blueprints.
- Create anything else before I pull the trigger and go to 0.18, probably plenty of time for other dependencies to update.
Thought I would update you since you asked ๐
OH typing to you gave me another idea, I am going to change the tab headings to be a list of checkboxes that will be used to filter
Thanks for being a rubber ducky
Finally moved all my cobweb logic away.
Still have bevy_cobweb_ui, not prepared to move away fully.
I will stick to plan of trying to create every UI I can think of in cobweb.
Now that I have switched, I think cobweb was not the right way of sorting my program.
- I often display similar information in different places, I prioritise having the information you care about close at hand, means you can do one query and update text in multiple places.
- Marker components and observers involve less nesting and closures, I have been soured on closures by it's poor support for cargo fmt and type inference (Not cobwebs fault!).
- I should have done cobweb updates more at parent level to avoid having multiple redundant lookups, and shared workload.
But being on cobweb means the Bevy event/messages name changes didn't impact mes as much