Expand description
A Bevy plugin the provides a simple single-line text input widget.
§Examples
See the examples folder.
use bevy::prelude::*;
use bevy_simple_text_input::{TextInput, TextInputPlugin};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(TextInputPlugin)
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(Camera2d);
commands.spawn((
TextInput,
Node {
padding: UiRect::all(Val::Px(5.0)),
border: UiRect::all(Val::Px(2.0)),
..default()
},
BorderColor(Color::BLACK)
));
}
Structs§
- Text
Input - The main “driving component” for the Text Input.
- Text
Input Binding - A combination of a key and required modifier keys that might trigger a
TextInputAction
. - Text
Input Cursor Pos - A component containing the current text cursor position.
- Text
Input Cursor Timer - A component that manages the cursor’s blinking.
- Text
Input Inactive - If true, the text input does not respond to keyboard events and the cursor is hidden.
- Text
Input Navigation Bindings - A resource in which key bindings can be specified. Bindings are given as a tuple of (
TextInputAction
,TextInputBinding
). - Text
Input Placeholder - A component containing the placeholder text that is displayed when the text input is empty and not focused.
- Text
Input Plugin - A Bevy
Plugin
providing the systems and assets required to make aTextInput
work. - Text
Input Settings - A component containing the text input’s settings.
- Text
Input Submit Event - An event that is fired when the user presses the enter key.
- Text
Input System - Label for systems that update text inputs.
- Text
Input Text Color - The Bevy
TextColor
that will be used when creating the text input’s inner BevyTextBundle
. - Text
Input Text Font - The Bevy
TextColor
that will be used when creating the text input’s inner BevyTextBundle
. - Text
Input Value - A component containing the current value of the text input.
Enums§
- Text
Input Action - Text navigation actions that can be bound via
TextInputNavigationBindings
.