Skip to content

Commit baa94e0

Browse files
committed
Refactor UI into widgets, add panels for diagnostics and resources
1 parent fa2a3d4 commit baa94e0

39 files changed

+3214
-1017
lines changed

Cargo.toml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,19 @@ version = "0.1.0"
44
authors = ["Brice DAVIER <bricedavier@gmail.com>"]
55
edition = "2018"
66

7+
[features]
8+
# default = ["extra"]
9+
default = []
10+
extra = []
11+
712
[dependencies]
8-
bevy = "0.4.0"
13+
bevy = { version = "0.4.0", default-features = false }
914
ron = "0.6.4"
1015
serde = "1.0"
11-
interpolation = "0.2.0"
16+
interpolation = "0.2.0"
17+
# bevy_system_diagnostics = { path = "../bevy_system_diagnostics" }
18+
wgpu = "0.6"
19+
image = "0.23.12"
20+
21+
[patch.crates-io]
22+
bevy = { path = "../bevy/" } # FIXME

README.md

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,46 @@
11
# Bevy Debug Menu
22

3-
This crate adds a debug menu to your [Bevy](https://bevyengine.org) game that can show and edit all the current entities.
3+
This crate adds a debug menu to your [Bevy](https://bevyengine.org) game. It can show your diagnostics, and explore and edit the current entities and resources.
44

5-
Usage:
5+
## Usage
6+
7+
* make sure you are using `bevy` from a recent `master` branch
8+
* add dependency in `Cargo.toml`:
9+
```toml
10+
[dependencies]
11+
bevy_debug_menu = { git = "https://github.com/Davier/bevy_debug_menu" }
12+
```
13+
* add the `DebugMenuPlugin` to your bevy app
14+
* launch the app and press `F10` to show or hide the menu
615

7-
* add the [DebugMenuPlugin] to your bevy app
8-
* add the [DebugMenuFont] resource (and the font file to your `assets/` folder)
9-
* optional: adapt your game to stop processing keyboard inputs by listening to [FocusedEvent] and [UnfocusedEvent]
10-
* press F10 to show or hide the menu
11-
12-
## Warnings
1316

14-
You need to compile in release mode to have descent frame rate.
17+
## Optional setup
1518

16-
This contains unsafe code that needs reviewing.
19+
* derive `Reflect`, `ReflectComponent` and `ReflectResource` on your types
20+
* adapt your game to stop processing keyboard inputs when editing entities by listening to `FocusedEvent` and `UnfocusedEvent`
1721

18-
The debug menu will push the rest of your UI elements even when hidden. A PR is being made to bevy to fix that.
22+
## Warnings
1923

20-
This is a prototype.
24+
* you need to compile in release mode to have descent frame rate
25+
* with default features, the debug menu will push the rest of your UI elements even when hidden (see [#1211](https://github.com/bevyengine/bevy/pull/1211))
26+
* with default features, the "Resource" panel is disabled (see [#1260](https://github.com/bevyengine/bevy/pull/1260))
27+
* both issues can be fixed by using a bevy fork and enabling the `extra` feature in `Cargo.toml`:
28+
```toml
29+
[dependencies]
30+
bevy_debug_menu = { git = "https://github.com/Davier/bevy_debug_menu", features = ["extra"] }
31+
[patch.crates-io]
32+
bevy = { git = "https://github.com/Davier/bevy", branch = "extra" }
33+
```
2134

2235
## Example
2336

24-
```
37+
```rust
2538
use bevy::prelude::*;
2639

2740
fn main() {
2841
App::build()
2942
.add_plugins(DefaultPlugins)
3043
.add_plugin(bevy_debug_menu::DebugMenuPlugin)
31-
.add_resource(bevy_debug_menu::DebugMenuFont{
32-
path: "your_font.ttf"
33-
})
3444
// This is unnecessary if you already initialize the UI camera in your game
3545
.add_startup_system(bevy_debug_menu::setup_ui_camera.system())
3646
.run();
@@ -39,11 +49,9 @@ fn main() {
3949

4050
## TODO
4151

42-
* filtering for components
43-
* remove entities/components
44-
* improve the edit box widget
45-
* always draw over other UI elements
46-
* specialized widgets to edit some types (e.g. bool, ints, floats)
47-
* implement reflection for enums
52+
* search by resource type, component type, entity Name and entity Label
53+
* remove resource, entity, component
54+
* load/save scene
55+
* list and spawn loaded scenes
4856
* integration with bevy_mod_picking
49-
57+
* implement reflection for enums

assets/FiraMono-Bold.ttf

196 KB
Binary file not shown.

assets/FiraSans-Bold.ttf

428 KB
Binary file not shown.

assets/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Icons
2+
3+
`chevron-up.svg` and `chevron-down.svg` are from https://github.com/twbs/icons under MIT license.

assets/chevron-down-background.svg

Lines changed: 76 additions & 0 deletions
Loading

assets/chevron-down.png

983 Bytes
Loading

assets/chevron-down.svg

Lines changed: 3 additions & 0 deletions
Loading

assets/chevron-up-background.svg

Lines changed: 65 additions & 0 deletions
Loading

assets/chevron-up.png

977 Bytes
Loading

0 commit comments

Comments
 (0)