Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bevy Cosmic Edit
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Bevy Forks
Bevy Cosmic Edit
Commits
300813c6
Commit
300813c6
authored
11 months ago
by
sam edelsten
Browse files
Options
Downloads
Patches
Plain Diff
add README to `lib.rs`
parent
7a1922f3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib.rs
+79
-0
79 additions, 0 deletions
src/lib.rs
with
79 additions
and
0 deletions
src/lib.rs
+
79
−
0
View file @
300813c6
//! # bevy_cosmic_edit
//!
//! Multiline text editor using [`cosmic_text`] for the [`bevy`] game engine!
//!
//! This bevy plugin provides multiline text editing for bevy apps, thanks to [cosmic_text](https://github.com/pop-os/cosmic-text) crate!
//! Emoji, ligatures, and other fancy stuff is supported!
//!
//! 
//!
//! ## Usage
//!
//! *Warning: This plugin is currently in early development, and its API is subject to change.*
//!
//! ```
//! use bevy::prelude::*;
//! use bevy_cosmic_edit::*;
//!
//! fn setup(mut commands: Commands, mut font_system: ResMut<CosmicFontSystem>) {
//! commands.spawn(Camera2dBundle::default());
//!
//! // Text attributes
//! let font_size = 16.0;
//! let line_height = 18.0;
//! let attrs = Attrs::new()
//! .family(Family::Monospace)
//! .color(Color::DARK_GRAY.to_cosmic())
//! .weight(FontWeight::BOLD);
//!
//! // Spawning
//! commands.spawn(CosmicEditBundle {
//! buffer: CosmicBuffer::new(&mut font_system, Metrics::new(font_size, line_height))
//! .with_text(&mut font_system, "Hello, Cosmic!", attrs),
//! sprite_bundle: SpriteBundle {
//! sprite: Sprite {
//! custom_size: Some(Vec2::new(300.0, 40.0)),
//! ..default()
//! },
//! ..default()
//! },
//! ..default()
//! });
//! }
//!
//! fn main() {
//! App::new()
//! .add_plugins(DefaultPlugins)
//! .add_plugins(CosmicEditPlugin::default())
//! .add_systems(Startup, setup)
//! .add_systems(Update, change_active_editor_sprite)
//! .run();
//! }
//! ```
//!
//! Check the examples folder for much more!
//!
//! Native:
//!
//! ```shell
//! $ cargo r --example font_per_widget
//! ```
//!
//! Wasm:
//!
//! ```shell
//! $ cargo install wasm-server-runner
//! $ RUSTFLAGS=--cfg=web_sys_unstable_apis cargo r --target wasm32-unknown-unknown --example basic_ui
//! ```
//!
//! ## Compatibility
//!
//! | bevy | bevy_cosmic_edit |
//! | ------ | ---------------- |
//! | 0.13.0 | 0.16 - latest |
//! | 0.12.* | 0.15 |
//! | 0.11.* | 0.8 - 0.14 |
//!
//! ## License
//!
//! MIT or Apache-2.0
#![allow(clippy::type_complexity)]
mod
buffer
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment