From f47d32b54d9e160149267369416ae546e5100c78 Mon Sep 17 00:00:00 2001 From: Elijah Voigt Date: Thu, 10 Aug 2023 19:34:21 -0700 Subject: [PATCH] saving my place --- bin/editor.rs | 16 ++++++++++++++-- bin/ui-wtf.rs | 25 +++++++++++++++---------- src/ui.rs | 17 ++--------------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/bin/editor.rs b/bin/editor.rs index d11babe..03eae89 100644 --- a/bin/editor.rs +++ b/bin/editor.rs @@ -103,7 +103,13 @@ fn initialize_ui(mut commands: Commands) { .spawn(( GameUiList, Name::new("GLTFs"), - NodeBundle { ..default() }, + NodeBundle { + style: Style { + flex_direction: FlexDirection::Row, + ..default() + }, + ..default() + }, GltfsUi, UiCollapse::Show, )) @@ -133,7 +139,13 @@ fn initialize_ui(mut commands: Commands) { parent.spawn(( GameUiSet, Name::new("Audio Clips"), - NodeBundle { ..default() }, + NodeBundle { + style: Style { + flex_direction: FlexDirection::Column, + ..default() + }, + ..default() + }, AudioClipsUi, UiCollapse::Show, )); diff --git a/bin/ui-wtf.rs b/bin/ui-wtf.rs index 5aa0cda..9c8e36a 100644 --- a/bin/ui-wtf.rs +++ b/bin/ui-wtf.rs @@ -197,17 +197,22 @@ fn container( match (key_code, state) { (Some(KeyCode::Up), ButtonState::Pressed) => { commands.entity(root.single()).with_children(|parent| { - parent.spawn(NodeBundle { - style: Style { - width: Val::Px(10.0), - height: Val::Px(10.0), - padding: UiRect::all(Val::Px(10.0)), - margin: UiRect::all(Val::Px(10.0)), + parent + .spawn(ButtonBundle { + style: Style { + padding: UiRect::all(Val::Px(10.0)), + margin: UiRect::all(Val::Px(10.0)), + ..default() + }, + background_color: BackgroundColor(Color::PURPLE), ..default() - }, - background_color: BackgroundColor(Color::PURPLE), - ..default() - }); + }) + .with_children(|parent| { + parent.spawn(TextBundle::from_section( + "asdfwtf", + TextStyle { ..default() }, + )); + }); }); } (Some(KeyCode::Down), ButtonState::Pressed) => { diff --git a/src/ui.rs b/src/ui.rs index 360f669..32b786f 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -141,17 +141,11 @@ fn init_ui_list(events: Query<(Entity, &Name), Added>, mut commands: .entity(entity) .insert(NodeBundle { style: Style { - // align_content: AlignContent::FlexStart, - align_items: AlignItems::Stretch, - border: UiRect::all(Val::Px(2.0)), flex_direction: FlexDirection::Column, justify_items: JustifyItems::Center, + border: UiRect::all(Val::Px(2.0)), margin: UiRect::all(Val::Px(2.0)), padding: UiRect::all(Val::Px(2.0)), - // overflow: Overflow { - // x: OverflowAxis::Clip, - // y: OverflowAxis::Clip, - // }, ..default() }, background_color: BackgroundColor(Color::RED), @@ -181,17 +175,11 @@ fn init_ui_set(events: Query<(Entity, &Name), Added>, mut commands: C .entity(entity) .insert(NodeBundle { style: Style { - // align_content: AlignContent::FlexStart, - align_items: AlignItems::FlexStart, - border: UiRect::all(Val::Px(2.0)), flex_direction: FlexDirection::Row, flex_wrap: FlexWrap::Wrap, + border: UiRect::all(Val::Px(2.0)), margin: UiRect::all(Val::Px(2.0)), padding: UiRect::all(Val::Px(2.0)), - // overflow: Overflow { - // x: OverflowAxis::Clip, - // y: OverflowAxis::Clip, - // }, ..default() }, background_color: BackgroundColor(Color::BLUE), @@ -225,7 +213,6 @@ fn init_ui_button(events: Query<(Entity, &Name), Added>, mut comma margin: UiRect::all(Val::Px(2.0)), padding: UiRect::all(Val::Px(2.0)), border: UiRect::all(Val::Px(2.0)), - justify_content: JustifyContent::Center, ..default() }, background_color: BackgroundColor(Color::GREEN),