Skip to content

Commit

Permalink
Update for breaking changes from text style split
Browse files Browse the repository at this point in the history
  • Loading branch information
rparrett committed Oct 17, 2024
1 parent 01099d2 commit c0ba24b
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 72 deletions.
7 changes: 4 additions & 3 deletions examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
use bevy::prelude::*;
use bevy_simple_text_input::{
TextInput, TextInputPlugin, TextInputSubmitEvent, TextInputSystem, TextInputTextStyle,
TextInput, TextInputPlugin, TextInputSubmitEvent, TextInputSystem, TextInputTextColor,
TextInputTextFont,
};

const BORDER_COLOR_ACTIVE: Color = Color::srgb(0.75, 0.52, 0.99);
Expand Down Expand Up @@ -46,11 +47,11 @@ fn setup(mut commands: Commands) {
..default()
},
TextInput,
TextInputTextStyle(TextStyle {
TextInputTextFont(TextFont {
font_size: 34.,
color: TEXT_COLOR,
..default()
}),
TextInputTextColor(TextColor(TEXT_COLOR)),
));
});
}
Expand Down
8 changes: 4 additions & 4 deletions examples/focus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use bevy::prelude::*;
use bevy_simple_text_input::{
TextInput, TextInputInactive, TextInputPlaceholder, TextInputPlugin, TextInputSystem,
TextInputTextStyle,
TextInputTextColor, TextInputTextFont,
};

const BORDER_COLOR_ACTIVE: Color = Color::srgb(0.75, 0.52, 0.99);
Expand Down Expand Up @@ -56,14 +56,14 @@ fn setup(mut commands: Commands) {
..default()
},
TextInput,
TextInputTextStyle(TextStyle {
TextInputTextFont(TextFont {
font_size: 34.,
color: TEXT_COLOR,
..default()
}),
TextInputTextColor(TextColor(TEXT_COLOR)),
TextInputPlaceholder {
value: "Click Me".to_string(),
text_style: None,
..default()
},
TextInputInactive(true),
));
Expand Down
7 changes: 4 additions & 3 deletions examples/password.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
use bevy::prelude::*;
use bevy_simple_text_input::{
TextInput, TextInputPlugin, TextInputSettings, TextInputTextStyle, TextInputValue,
TextInput, TextInputPlugin, TextInputSettings, TextInputTextColor, TextInputTextFont,
TextInputValue,
};

const BORDER_COLOR_ACTIVE: Color = Color::srgb(0.75, 0.52, 0.99);
Expand Down Expand Up @@ -46,11 +47,11 @@ fn setup(mut commands: Commands) {
},
TextInput,
TextInputValue("password".to_string()),
TextInputTextStyle(TextStyle {
TextInputTextFont(TextFont {
font_size: 34.,
color: TEXT_COLOR,
..default()
}),
TextInputTextColor(TextColor(TEXT_COLOR)),
TextInputSettings {
mask_character: Some('*'),
retain_on_submit: true,
Expand Down
12 changes: 7 additions & 5 deletions examples/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
use bevy::prelude::*;
use bevy_simple_text_input::{
TextInput, TextInputPlugin, TextInputSettings, TextInputTextStyle, TextInputValue,
TextInput, TextInputPlugin, TextInputSettings, TextInputTextColor, TextInputTextFont,
TextInputValue,
};

const BORDER_COLOR_ACTIVE: Color = Color::srgb(0.75, 0.52, 0.99);
Expand All @@ -26,11 +27,11 @@ struct IncValueButton;
fn setup(mut commands: Commands) {
commands.spawn(Camera2d);

let text_style = TextStyle {
let text_font = TextFont {
font_size: 40.,
color: TEXT_COLOR,
..default()
};
let text_color = TextColor(TEXT_COLOR);

commands
.spawn(NodeBundle {
Expand Down Expand Up @@ -58,7 +59,8 @@ fn setup(mut commands: Commands) {
..default()
},
TextInput,
TextInputTextStyle(text_style.clone()),
TextInputTextFont(text_font.clone()),
TextInputTextColor(text_color.clone()),
TextInputValue("1".to_string()),
TextInputSettings {
retain_on_submit: true,
Expand All @@ -83,7 +85,7 @@ fn setup(mut commands: Commands) {
IncValueButton,
))
.with_children(|parent| {
parent.spawn((Text::new("+"), text_style.clone()));
parent.spawn((Text::new("+"), text_font, text_color));
});
});
}
Expand Down
Loading

0 comments on commit c0ba24b

Please sign in to comment.