Skip to content

Commit e9eb92f

Browse files
committed
fix inventory
1 parent f724cdc commit e9eb92f

22 files changed

+596
-554
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ bevy_window = { version = "0.17", default-features = false }
3939
bevy_winit = { version = "0.17", default-features = false, features = ["x11"] }
4040
bevy_ui_text_input = { version = "0.6", default-features = false, optional = true }
4141
bevy-async-ecs = { version = "0.9", optional = true }
42-
jonmo = { version = "0.4", path = "../jonmo", features = ["builder"] }
42+
jonmo = "0.5"
4343
cosmic-text = "0.14.2"
4444
apply = "0.3"
4545
cfg-if = "1.0"

examples/align.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,16 @@ struct RectangleContentAlignment(Option<RectangleAlignment>);
7070
fn alignment_button(alignment: Alignment) -> impl Element {
7171
let lazy_entity = LazyEntity::new();
7272
El::<Node>::new()
73+
.insert(Pickable::default())
7374
.align(Align::center())
7475
.cursor(CursorIcon::System(SystemCursorIcon::Pointer))
7576
.with_node(|mut node| {
7677
node.width = Val::Px(250.);
7778
node.height = Val::Px(80.);
7879
})
79-
.with_builder(|builder| builder.lazy_entity(lazy_entity.clone()))
80+
.lazy_entity(lazy_entity.clone())
8081
.background_color_signal(
81-
signal::or!(
82+
signal::any!(
8283
SignalBuilder::from_lazy_entity(lazy_entity)
8384
.has_component::<Hovered>()
8485
.dedupe(),
@@ -105,6 +106,8 @@ fn alignment_button(alignment: Alignment) -> impl Element {
105106

106107
fn ui_root() -> impl Element {
107108
Column::<Node>::new()
109+
.ui_root()
110+
.insert(Pickable::default())
108111
.with_node(|mut node| {
109112
node.width = Val::Percent(100.);
110113
node.height = Val::Percent(100.);
@@ -219,11 +222,12 @@ fn rectangles() -> Vec<impl Element> {
219222
fn align_switcher(rectangle_alignment: RectangleAlignment) -> impl Element {
220223
let lazy_entity = LazyEntity::new();
221224
El::<Node>::new()
225+
.insert(Pickable::default())
222226
.align(rectangle_alignment.to_align())
223227
.cursor(CursorIcon::System(SystemCursorIcon::Pointer))
224-
.with_builder(|builder| builder.lazy_entity(lazy_entity.clone()))
228+
.lazy_entity(lazy_entity.clone())
225229
.background_color_signal(
226-
signal::or!(
230+
signal::any!(
227231
SignalBuilder::from_resource::<Alignment>()
228232
.dedupe()
229233
.switch(move |In(alignment): In<Alignment>| {

examples/button.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ fn button() -> impl Element {
5151
.cursor(CursorIcon::System(SystemCursorIcon::Pointer))
5252
.align_content(Align::center())
5353
.border_radius(BorderRadius::MAX)
54-
.with_builder(|builder| builder.lazy_entity(lazy_entity.clone()))
54+
.lazy_entity(lazy_entity.clone())
5555
.border_color_signal(
5656
pressed_hovered_signal
5757
.clone()

examples/calculator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ fn button(symbol: &'static str) -> El<Node> {
8080
fn input_button(symbol: &'static str) -> impl Element {
8181
let lazy_entity = LazyEntity::new();
8282
button(symbol)
83-
.with_builder(|builder| builder.lazy_entity(lazy_entity.clone()))
83+
.lazy_entity(lazy_entity.clone())
8484
.cursor(CursorIcon::System(SystemCursorIcon::Pointer))
8585
.background_color_signal(
8686
SignalBuilder::from_lazy_entity(lazy_entity)
@@ -131,7 +131,7 @@ fn clear_button() -> impl Element {
131131
.map_in_ref(String::is_empty);
132132
let lazy_entity = LazyEntity::new();
133133
button("c")
134-
.with_builder(|builder| builder.lazy_entity(lazy_entity.clone()))
134+
.lazy_entity(lazy_entity.clone())
135135
.background_color_signal(
136136
output_empty
137137
.clone()

examples/character_editor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ fn button(shape: Shape) -> impl Element {
112112
node.border = UiRect::all(Val::Px(5.));
113113
})
114114
.align_content(Align::center())
115-
.with_builder(|builder| builder.lazy_entity(lazy_entity.clone()))
115+
.lazy_entity(lazy_entity.clone())
116116
.border_color_signal(
117117
selected_pressed_hovered_signal
118118
.clone()
@@ -178,7 +178,7 @@ fn ui_root() -> impl Element {
178178
.item({
179179
let lazy_entity = LazyEntity::new();
180180
El::<Node>::new()
181-
.with_builder(|builder| builder.insert(BackgroundColor(NORMAL_BUTTON)))
181+
.insert(BackgroundColor(NORMAL_BUTTON))
182182
.with_node(|mut node| node.height = Val::Px(BUTTON_HEIGHT))
183183
.child(
184184
TextInput::new()
@@ -200,7 +200,7 @@ fn ui_root() -> impl Element {
200200
color: Some(bevy::color::palettes::basic::GRAY.into()),
201201
..default()
202202
})
203-
.with_builder(|builder| builder.lazy_entity(lazy_entity.clone()))
203+
.lazy_entity(lazy_entity.clone())
204204
.on_change_with_system(
205205
|In((_, text)),
206206
mut scroll_pos: ResMut<ScrollPosition>,

examples/counter.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ fn ui_root() -> impl Element {
3636
.child(
3737
Row::<Node>::new()
3838
.with_node(|mut node| node.column_gap = Val::Px(15.0))
39-
.with_builder(|builder| builder.insert(Counter(0)).lazy_entity(counter_holder.clone()))
39+
.insert(Counter(0))
40+
.lazy_entity(counter_holder.clone())
4041
.item(counter_button(counter_holder.clone(), "-", -1))
4142
.item(
4243
El::<Text>::new().text_font(TextFont::from_font_size(25.)).text_signal(
@@ -59,7 +60,7 @@ fn counter_button(counter_holder: LazyEntity, label: &'static str, step: i32) ->
5960
.align_content(Align::center())
6061
.border_radius(BorderRadius::MAX)
6162
.cursor(CursorIcon::System(SystemCursorIcon::Pointer))
62-
.with_builder(|builder| builder.lazy_entity(button_holder.clone()))
63+
.lazy_entity(button_holder.clone())
6364
.background_color_signal(
6465
SignalBuilder::from_lazy_entity(button_holder)
6566
.has_component::<Hovered>()

examples/dot_counter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ where
167167
.with_node(|mut node| node.width = Val::Px(45.0))
168168
.align_content(Align::center())
169169
.cursor(CursorIcon::System(SystemCursorIcon::Pointer))
170-
.with_builder(|builder| builder.lazy_entity(lazy_entity.clone()))
170+
.lazy_entity(lazy_entity.clone())
171171
.background_color_signal(
172172
SignalBuilder::from_lazy_entity(lazy_entity)
173173
.has_component::<Hovered>()

examples/dragging.rs

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -116,26 +116,18 @@ fn square(i: usize) -> impl Element {
116116
.map_in(CursorIcon::System)
117117
.dedupe(),
118118
)
119-
.with_builder(move |builder| {
120-
builder
121-
.lazy_entity(lazy_entity.clone())
122-
.insert((Pickable::default(), DragOffset::default()))
123-
.observe(
124-
|click: On<Pointer<Press>>,
125-
max_z_index: ResMut<MaxZIndex>,
126-
z_indices: Query<&mut GlobalZIndex>,
127-
drag_offsets: Query<&mut DragOffset>,
128-
nodes: Query<&Node>| {
129-
calculate_and_set_drag_offset(
130-
click.entity,
131-
click.pointer_location.position,
132-
&nodes,
133-
drag_offsets,
134-
);
135-
update_z_index(click.entity, max_z_index, z_indices);
136-
},
137-
)
138-
})
119+
.lazy_entity(lazy_entity.clone())
120+
.insert((Pickable::default(), DragOffset::default()))
121+
.observe(
122+
|click: On<Pointer<Press>>,
123+
max_z_index: ResMut<MaxZIndex>,
124+
z_indices: Query<&mut GlobalZIndex>,
125+
drag_offsets: Query<&mut DragOffset>,
126+
nodes: Query<&Node>| {
127+
calculate_and_set_drag_offset(click.entity, click.pointer_location.position, &nodes, drag_offsets);
128+
update_z_index(click.entity, max_z_index, z_indices);
129+
},
130+
)
139131
.on_dragging(
140132
|In((entity, dragging_data)): In<(Entity, DraggingData)>, mut nodes: Query<(&mut Node, &DragOffset)>| {
141133
if let Ok((node, drag_offset)) = nodes.get_mut(entity) {

examples/healthbar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ fn respawn_button() -> impl Element {
215215
node.height = Val::Px(80.);
216216
})
217217
.cursor(CursorIcon::System(SystemCursorIcon::Pointer))
218-
.with_builder(|builder| builder.lazy_entity(lazy_entity.clone()))
218+
.lazy_entity(lazy_entity.clone())
219219
.background_color_signal(
220220
SignalBuilder::from_lazy_entity(lazy_entity)
221221
.has_component::<Hovered>()

0 commit comments

Comments
 (0)