bevy_cef_core 0.10.0

Core library for bevy_cef
docs.rs failed to build bevy_cef_core-0.10.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

bevy_cef

A powerful Bevy plugin for embedding web content using the Chromium Embedded Framework (CEF). Render websites, local HTML files, and web applications directly onto 3D meshes or 2D sprites with full interactivity and bidirectional communication between JavaScript and Bevy.

Crates.io Documentation License

https://github.com/user-attachments/assets/54f476d0-8eda-4030-a3f6-dc4f2f54209f

โœจ Features

  • ๐ŸŒ Full Web Browser Integration - Embed complete web pages with CSS, JavaScript, and modern web APIs
  • ๐ŸŽฎ 3D Mesh & 2D Sprite Rendering - Render web content on any 3D surface or 2D sprite
  • โšก Interactive Input - Full mouse, keyboard, and touch input support with automatic event forwarding
  • ๐Ÿ”„ Bidirectional Communication - Seamless data exchange between JavaScript and Bevy systems
  • ๐Ÿ“ Local Asset Serving - Serve local HTML/CSS/JS files with hot reload support
  • ๐Ÿ› ๏ธ Developer Tools - Full Chrome DevTools integration for debugging
  • ๐ŸŽฏ Navigation Controls - Browser history, zoom, audio controls, and more
  • ๐Ÿ”’ Multi-Process Architecture - Secure CEF multi-process design for stability

Platform Requirements

Macos

On macOS, using CEF typically requires creating an app bundle. For development, this library provides a debug feature flag. Once enabled, you can run the app without needing the bundle.

[!NOTE] Use this feature only during development; for releases, bundle the renderer process and the CEF framework inside the app.

Installation debug tools

When using debug, you need to prepare a separate CEF framework and debug render process. Install them in one step:

> make setup-macos

make setup-macos installs the build tools (cmake, ninja) via Homebrew, runs export-cef-dir to populate $HOME/.local/share/cef, then builds bevy_cef_debug_render_process and copies it into the framework's Libraries directory ($HOME/.local/share/cef/Chromium Embedded Framework.framework/Libraries).

Bundling for Release

Install the bundling tools:

> cargo install bevy_cef_render_process
> cargo install bevy_cef_bundle_app

Bundle CEF into your .app:

> bevy_cef_bundle_app --app path/to/YourApp.app --bundle-id-base com.example.yourapp

Run bevy_cef_bundle_app --help for additional options.

Windows

On Windows, you need to place CEF libraries in the same directory as the application executable. Please run the following command to install the CEF framework to local. When you build the project, the libraries will be automatically copied to the executable's directory.

> cargo install export-cef-dir@145.6.1+145.0.28 --force
> export-cef-dir --force "$HOME/.local/share/cef"

Render process binary (recommended)

Install the dedicated render process binary so that CEF launches it directly instead of re-using your main executable. This avoids the brief window flash that occurs when the main executable is re-launched as a subprocess.

> cargo install bevy_cef_render_process

The build.rs script automatically copies the installed binary next to your executable during the build.

Fallback

If you do not install the render process binary, CEF will re-launch your main executable for its subprocesses. To prevent those subprocess instances from briefly showing a window, call early_exit_if_subprocess() at the very beginning of main() โ€” before any Bevy initialization:

fn main() {
    bevy_cef::prelude::early_exit_if_subprocess();
    // ... Bevy App setup ...
}

Linux

CEF runs windowless on Linux, so X11, XWayland, and native Wayland sessions are all supported through Bevy's normal windowing.

Install the system packages required by CEF, then install CEF and the dedicated render process binary in one step:

> sudo apt-get install --no-install-recommends \
    libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libgbm1 \
    libpango-1.0-0 libcairo2 libgtk-3-0
> make setup-linux

make setup-linux runs export-cef-dir to populate $HOME/.local/share/cef and then installs bevy_cef_render_process into the same directory. On build, build.rs copies CEF's .so/.pak/.dat/.bin files and the render process binary next to your executable.

If you do not install the render process binary, call bevy_cef::prelude::early_exit_if_subprocess() at the top of main() as on Windows.

Examples

See examples/.

On macOS, you need to enable the debug feature:

cargo run --example simple --features debug

On Windows and Linux, no extra feature flag is needed:

cargo run --example simple

๐ŸŒ Platform Support

Platform Status
macOS โœ… Full
Windows โœ… Full
Linux โœ… Supported (windowless)

๐Ÿค Contributing

We welcome contributions! Here's how you can help:

  1. ๐Ÿ› Bug Reports - Open an issue with detailed reproduction steps
  2. ๐Ÿ’ก Feature Requests - Suggest new features or improvements
  3. ๐Ÿ”ง Pull Requests - Submit bug fixes or new features
  4. ๐Ÿ“š Documentation - Improve docs, examples, or tutorials
  5. ๐Ÿงช Testing - Help test on different platforms

Development Setup

  1. Clone the repository
  2. Install Rust and Cargo
  3. Install the debugging tool with reference to Installation debug tools.
  4. Run cargo build --features debug to build the project

Version Compatibility

Bevy bevy_cef CEF
0.18 ~ 0.5.0 145.6.1+145.0.28
0.18 0.2.0 144.4.0
0.16 0.1.0 139

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.