bevy_mod_clipboard
Basic clipboard support for Bevy.
Features
- Simple API using the
Clipboardresource. - Asynchronous cross-platform clipboard access.
- Supports
windows,linux,macosandwasm32targets. - Send and fetch text to and from the clipboard to Bevy.
Usage
First add the ClipboardPlugin plugin to your Bevy app:
app.add_plugins;
Interact with the clipboard through the Clipboard resource.
To read from the clipboard call Clipboard::fetch_text.
It returns a ClipboardRead:
- On windows and Unix-like platforms, the result is ready immediately.
- On
wasm32, reads are asynchronous. Store theClipboardReadand callpoll_result()on subsequent frames until it returns Some.
To write to the clipboard, call Clipboard::set_text.
Example
use NAVY;
use *;
use Clipboard;
use ClipboardPlugin;
use ClipboardRead;
/// Fetches the current text contents of the clipboard each frame and updates
/// the text node if it has changed.
Included with the crate, run with:
cargo run --example fetch_text