add an option about display server protocol, and create document docs/cargo_features.md (#249)

add an option about display server protocol, and create document `docs/cargo_features.md`
This commit is contained in:
VitalyR 2020-08-25 08:06:08 +08:00 committed by GitHub
parent f7131509b9
commit c78187e6df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 79 additions and 3 deletions

View file

@ -13,7 +13,7 @@ readme = "README.md"
exclude = ["assets/**/*", "tools/**/*", ".github/**/*", "crates/**/*"]
[features]
default = ["bevy_audio", "bevy_gltf", "bevy_wgpu", "bevy_winit", "png", "hdr", "mp3"]
default = ["bevy_audio", "bevy_gltf", "bevy_wgpu", "bevy_winit", "png", "hdr", "mp3", "x11"]
profiler = ["bevy_ecs/profiler", "bevy_diagnostic/profiler"]
wgpu_trace = ["bevy_wgpu/trace"]
@ -29,6 +29,10 @@ vorbis = ["bevy_audio/vorbis"]
serialize = ["bevy_input/serialize"]
# Display server protocol support (X11 is enabled by default)
wayland = ["bevy_winit/wayland"]
x11 = ["bevy_winit/x11"]
[workspace]
members = [
"crates/*",

View file

@ -73,4 +73,8 @@ Bevy is only possible because of the hard work put into these foundational techn
* [winit](https://github.com/rust-windowing/winit): cross platform window creation and management in Rust
* [spirv-reflect](https://github.com/gwihlidal/spirv-reflect-rs): Reflection API in rust for SPIR-V shader byte code
## [Bevy Cargo Features](docs/cargo_features.md)
The cargo features provided by Bevy, could be enabled for certain usages.
Additionally, we would like to thank the [Amethyst](https://github.com/amethyst/amethyst), [macroquad](https://github.com/not-fl3/macroquad), [coffee](https://github.com/hecrj/coffee), [ggez](https://github.com/ggez/ggez), and [Piston](https://github.com/PistonDevelopers/piston) projects for providing solid examples of game engine development in Rust. If you are looking for a Rust game engine, it is worth considering all of your options. Each engine has different design goals and some will likely resonate with you more than others.

View file

@ -9,6 +9,10 @@ repository = "https://github.com/bevyengine/bevy"
license = "MIT"
keywords = ["bevy"]
[features]
wayland = ["winit/wayland"]
x11 = ["winit/x11"]
[dependencies]
# bevy
bevy_app = { path = "../bevy_app", version = "0.1" }
@ -18,5 +22,5 @@ bevy_math = { path = "../bevy_math", version = "0.1" }
bevy_window = { path = "../bevy_window", version = "0.1" }
# other
winit = { version = "0.22.2", package = "cart-tmp-winit", default-features = false, features = ["x11"] }
winit = { version = "0.22.2", package = "cart-tmp-winit", default-features = false}
log = { version = "0.4", features = ["release_max_level_info"] }

61
docs/cargo_features.md Normal file
View file

@ -0,0 +1,61 @@
# Cargo Features
## Default Features
### bevy_audio
Audio support. All audio formats support depends on this.
### bevy_gltf
[glTF](https://www.khronos.org/gltf/) support.
### bevy_winit
GUI support.
### bevy_wgpu
Make use of GPU via [WebGPU](https://gpuweb.github.io/gpuweb/) support.
### png
PNG picture format support.
### hdr
[HDR](https://en.wikipedia.org/wiki/High_dynamic_range) support.
### mp3
Audio of mp3 format support.
### x11
Make GUI applications use X11 procotol. You could enable wayland feature to override this.
## Optional Features
### profiler
For profiler.
### wgpu_trace
For tracing wgpu.
### flac
FLAC audio fromat support. It's included in bevy_audio feature.
### wav
WAV audio format support.
### vorbis
Vorbis audio format support.
### wayland
Enable this to use Wayland display server protocol other than X11.

View file

@ -1,7 +1,10 @@
# Examples
These examples demonstrate the main features of Bevy and how to use them.
To run an example, use the command `cargo run --example <Example>`.
To run an example, use the command `cargo run --example <Example>`, and add the option `--features x11` or `--features wayland` to force the example to run on a specific window compositor, e.g.
```
cargo run --features wayland hello_world
```
## Hello, World!