5 releases

new 0.0.4 Jun 16, 2024
0.0.3 Jun 13, 2024
0.0.3-hotfix Jun 14, 2024
0.0.2 Jun 11, 2024
0.0.1 Jun 11, 2024

#620 in Game dev

Download history 152/week @ 2024-06-07 211/week @ 2024-06-14

363 downloads per month

MIT/Apache

34KB
187 lines

bevy_text_edit

crates.io docs.rs dependency status pipeline status

Quickstart

Plugin

Add plugin TextEditPlugin to the app and define which states it will run in:

#[derive(Clone, Debug, Default, Eq, PartialEq, Hash, States)]
enum GameState {
    #[default]
    Menu,
}

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        // Add the plugin
        .add_plugins(TextEditPlugin::new(vec![GameState::Menu]))
        .run;
}

If you don't care to game state and want to always run input text, use TextEditPluginNoState:

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        // Add the plugin
        .add_plugins(TextEditPluginNoState)
        .add_systems(Startup, setup)
        .run();
}

Component

Insert component TextEditable and Interaction into any text entity that needs to be editable:

commands.spawn((
    TextEditable, // Mark text is editable
    Interaction::None, // Mark entity is interactable
    TextBundle::from_section(
        "Input Text 1",
        TextStyle {
            font_size: 20.,
            ..default()
        },
    ),
));

Only text that is focused by clicking gets keyboard input.

License

Please see LICENSE.

Compatible Bevy Versions

bevy bevy_text_edit
0.13 0.0.1-0.0.4, branch master

Dependencies

~45–83MB
~1.5M SLoC