You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs-template/EXAMPLE_README.md.tpl
+26-26Lines changed: 26 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -59,37 +59,37 @@ git checkout v0.4.0
59
59
- [Optimizing](#optimizing)
60
60
- [Loading Assets](#loading-assets)
61
61
62
-
# The Bare Minimum
62
+
## The Bare Minimum
63
63
64
64
<!-- MD026 - Hello, World! looks better with the ! -->
65
65
<!-- markdownlint-disable-next-line MD026 -->
66
-
## Hello, World!
66
+
### Hello, World!
67
67
68
68
Example | Description
69
69
--- | ---
70
70
[`hello_world.rs`](./hello_world.rs) | Runs a minimal example that outputs "hello world"
71
71
72
-
# Cross-Platform Examples
72
+
## Cross-Platform Examples
73
73
{% for category, details in all_examples %}
74
-
## {{ category }}
74
+
###{{ category }}
75
75
76
76
{%if details.description is string %}{{ details.description }}
77
77
{% endif %}Example | Description
78
78
--- | ---
79
79
{% for example in details.examples %}[{{ example.name }}](../{{ example.path }}) | {{ example.description }}
80
80
{% endfor %}{% endfor %}
81
-
# Tests
81
+
## Tests
82
82
83
83
Example | Description
84
84
--- | ---
85
85
[How to Test Apps](../tests/how_to_test_apps.rs) | How to test apps (simple integration testing)
86
86
[How to Test Systems](../tests/how_to_test_systems.rs) | How to test systems with commands, queries or resources
87
87
88
-
# Platform-Specific Examples
88
+
## Platform-Specific Examples
89
89
90
-
## Android
90
+
### Android
91
91
92
-
### Setup
92
+
#### Setup
93
93
94
94
```sh
95
95
rustup target add aarch64-linux-android
@@ -102,7 +102,7 @@ When using `NDK (Side by side)`, the environment variable `ANDROID_NDK_ROOT` mus
102
102
103
103
Alternatively, you can install Android Studio.
104
104
105
-
### Build & Run
105
+
#### Build & Run
106
106
107
107
To build an Android app, you first need to build shared object files for the target architecture with `cargo-ndk`:
108
108
@@ -130,15 +130,15 @@ Or build it with Android Studio.
130
130
131
131
Then you can test it in your Android project.
132
132
133
-
#### About `libc++_shared.so`
133
+
##### About `libc++_shared.so`
134
134
135
135
Bevy may require `libc++_shared.so` to run on Android, as it is needed by the `oboe` crate, but typically `cargo-ndk` does not copy this file automatically.
136
136
137
137
To include it, you can manually obtain it from NDK source or use a `build.rs` script for automation, as described in the `cargo-ndk` [README](https://github.com/bbqsrc/cargo-ndk?tab=readme-ov-file#linking-against-and-copying-libc_sharedso-into-the-relevant-places-in-the-output-directory).
138
138
139
139
Alternatively, you can modify project files to include it when building an APK. To understand the specific steps taken in this project, please refer to the comments within the project files for detailed instructions(`app/CMakeList.txt`, `app/build.gradle`, `app/src/main/cpp/dummy.cpp`).
140
140
141
-
### Debugging
141
+
#### Debugging
142
142
143
143
You can view the logs with the following command:
144
144
@@ -154,7 +154,7 @@ Sometimes, running the app complains about an unknown activity. This may be fixe
154
154
adb uninstall org.bevyengine.example
155
155
```
156
156
157
-
### Old phones
157
+
#### Old phones
158
158
159
159
In its examples, Bevy targets the minimum Android API that Play Store <!-- markdown-link-check-disable -->
160
160
[requires](https://developer.android.com/distribute/best-practices/develop/target-sdk) to upload and update apps. <!-- markdown-link-check-enable -->
@@ -168,17 +168,17 @@ bevy = { version = "0.14", default-features = false, features = ["android-native
168
168
169
169
Then build it as the [Build & Run](#build--run) section stated above.
170
170
171
-
#### About `cargo-apk`
171
+
##### About `cargo-apk`
172
172
173
173
You can also build an APK with `cargo-apk`, a simpler and deprecated tool which doesn't support `GameActivity`. If you want to use this, there is a [folder](./mobile/android_basic) inside the mobile example with instructions.
174
174
175
175
Example | File | Description
176
176
--- | --- | ---
177
177
`android` | [`mobile/src/lib.rs`](./mobile/src/lib.rs) | A 3d Scene with a button and playing sound
178
178
179
-
## iOS
179
+
### iOS
180
180
181
-
### Setup
181
+
#### Setup
182
182
183
183
You need to install the correct rust targets:
184
184
@@ -190,7 +190,7 @@ You need to install the correct rust targets:
@@ -220,16 +220,16 @@ Example | File | Description
220
220
--- | --- | ---
221
221
`ios` | [`mobile/src/lib.rs`](./mobile/src/lib.rs) | A 3d Scene with a button and playing sound
222
222
223
-
## Wasm
223
+
### Wasm
224
224
225
-
### Setup
225
+
#### Setup
226
226
227
227
```sh
228
228
rustup target add wasm32-unknown-unknown
229
229
cargo install wasm-bindgen-cli
230
230
```
231
231
232
-
### Build & Run
232
+
#### Build & Run
233
233
234
234
Following is an example for `lighting`. For other examples, change the `lighting` in the
235
235
following commands.
@@ -249,17 +249,17 @@ javascript bindings to this wasm file in the output file `examples/wasm/target/w
249
249
Then serve `examples/wasm` directory to browser. i.e.
250
250
251
251
```sh
252
-
# cargo install basic-http-server
252
+
## cargo install basic-http-server
253
253
basic-http-server examples/wasm
254
254
255
-
# with python
255
+
## with python
256
256
python3 -m http.server --directory examples/wasm
257
257
258
-
# with ruby
258
+
## with ruby
259
259
ruby -run -ehttpd examples/wasm
260
260
```
261
261
262
-
#### WebGL2 and WebGPU
262
+
##### WebGL2 and WebGPU
263
263
264
264
Bevy support for WebGPU is being worked on, but is currently experimental.
265
265
@@ -273,13 +273,13 @@ Bevy has a helper to build its examples:
273
273
274
274
This helper will log the command used to build the examples.
275
275
276
-
### Audio in the browsers
276
+
#### Audio in the browsers
277
277
278
278
For the moment, everything is single threaded, this can lead to stuttering when playing audio in browsers. Not all browsers react the same way for all games, you will have to experiment for your game.
279
279
280
280
In browsers, audio is not authorized to start without being triggered by an user interaction. This is to avoid multiple tabs all starting to auto play some sounds. You can find more context and explanation for this on [Google Chrome blog](https://developer.chrome.com/blog/web-audio-autoplay/). This page also describes a JS workaround to resume audio as soon as the user interact with your game.
281
281
282
-
### Optimizing
282
+
#### Optimizing
283
283
284
284
On the web, it's useful to reduce the size of the files that are distributed.
285
285
With rust, there are many ways to improve your executable sizes, starting with
0 commit comments