Expand description
Extra BRP methods for Bevy applications
This crate provides additional Bevy Remote Protocol (BRP) methods that can be added to your Bevy application for enhanced remote control capabilities.
§Usage
Add the plugin to your Bevy app:
use bevy::prelude::*;
use bevy_brp_extras::BrpExtrasPlugin;
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(BrpExtrasPlugin::default())
.run();§Plugin Composability
BrpExtrasPlugin is designed to compose with existing BRP setups. If
RemotePlugin or
RemoteHttpPlugin are already added
to the app, BrpExtrasPlugin will skip adding them and register its methods
into the existing RemoteMethods resource.
Important: If RemoteHttpPlugin is already present, any port
configuration on BrpExtrasPlugin (with_port() or the BRP_EXTRAS_PORT
environment variable) will be ignored — the existing HTTP transport is used
as-is. A warning is logged when this occurs.
§HTTP Transport Configuration
On native targets, HTTP transport can be configured in three mutually exclusive ways (enforced at compile time):
- Default — uses
BRP_EXTRAS_PORTenv var or port 15702 - Explicit port —
BrpExtrasPlugin::with_port(9000) - Full control —
BrpExtrasPlugin::with_http_plugin(plugin)accepts a pre-configuredRemoteHttpPlugin
§Available BRP Methods
§App Lifecycle
§brp_extras/screenshot
Captures a screenshot of the primary window and saves it to a file.
path(string, required): file path where the screenshot will be saved
Note: Requires Bevy’s png feature enabled, otherwise files will be 0 bytes.
§brp_extras/shutdown
Schedules a graceful application shutdown. No parameters.
§brp_extras/set_window_title
Changes the title of the primary window.
title(string, required): new window title
§brp_extras/get_diagnostics
Returns FPS and frame time diagnostics from Bevy’s DiagnosticsStore.
No parameters. Requires the diagnostics cargo feature (enabled by default).
Returns current, average, and smoothed values for FPS and frame time, plus total frame count and history buffer metadata.
§Keyboard
§brp_extras/send_keys
Simulates keyboard input with a press-hold-release cycle. All keys are pressed simultaneously and held for the specified duration.
keys(array of strings, required): key codes (e.g.,["KeyA", "Space", "ShiftLeft"])duration_ms(u32, optional, default: 100, max: 60000): hold duration in milliseconds
§brp_extras/type_text
Types text sequentially, one character per frame, with proper shift handling for uppercase and symbols.
text(string, required): text to type (letters, numbers, symbols, newlines, tabs)
§Mouse
All mouse methods accept an optional window parameter (entity ID) to target
a specific window. Defaults to the primary window.
Button values: "Left", "Right", "Middle", "Back", "Forward"
§brp_extras/click_mouse
Performs a click (press and immediate release).
button(string, required)window(u64, optional)
§brp_extras/double_click_mouse
Performs two rapid clicks with configurable delay.
button(string, required)delay_ms(u32, optional, default: 250): delay between clickswindow(u64, optional)
§brp_extras/send_mouse_button
Presses and holds a mouse button for a specified duration.
button(string, required)duration_ms(u32, optional, default: 100, max: 60000)window(u64, optional)
§brp_extras/move_mouse
Moves the cursor by delta or to an absolute position. Exactly one must be provided.
delta([f32; 2], optional): relative movementposition([f32; 2], optional): absolute positionwindow(u64, optional)
§brp_extras/drag_mouse
Performs a smooth drag with linear interpolation over a number of frames.
button(string, required)start([f32; 2], required): starting positionend([f32; 2], required): ending positionframes(u32, required): number of frames to interpolate overwindow(u64, optional)
§brp_extras/scroll_mouse
Sends mouse wheel scroll events.
x(f32, required): horizontal scroll amounty(f32, required): vertical scroll amountunit(string, required):"Line"or"Pixel"window(u64, optional)
§Trackpad Gestures (macOS)
§brp_extras/double_tap_gesture
Sends a double-tap gesture event. No parameters.
§brp_extras/pinch_gesture
Sends a pinch gesture for zoom operations.
delta(f32, required): positive = zoom in, negative = zoom out
§brp_extras/rotation_gesture
Sends a rotation gesture.
delta(f32, required): rotation in radians
Structs§
- BrpExtras
Plugin - Plugin type for adding extra BRP methods.
- Http
Plugin Configured - HTTP transport configured with a user-provided
RemoteHttpPlugin. - Port
Configured - HTTP transport configured with an explicit port.
- Unconfigured
- No HTTP configuration specified — uses
BRP_EXTRAS_PORTenv var or default port.
Enums§
- Port
Display - Controls whether the BRP port is appended to the window title.
Constants§
- BrpExtras
Plugin - Plugin that adds extra BRP methods to a Bevy app
- DEFAULT_
REMOTE_ PORT - Default port for remote control connections
Traits§
- HasEffective
Port - Trait for HTTP configuration states that can resolve an effective port.