@@ -16,7 +16,7 @@ Visual gizmos to aid with development and debugging in [Bevy](https://bevyengine
16
16
17
17
# [ Demo] ( examples/demo.rs )
18
18
19
- This examples showcases all built-in gizmo types and interactions. Click on a gizmo and it will print to the console its name.
19
+ This examples showcases all built-in gizmo types and interactions. Try hovering and clicking the center gizmo!
20
20
21
21
```
22
22
cargo run --example demo
@@ -37,17 +37,17 @@ bevy_mod_gizmos = "0.3.1"
37
37
```
38
38
39
39
Add this to any file you want to use gizmos in
40
- ``` rs
40
+ ``` rust
41
41
use bevy_mod_gizmos :: * ;
42
42
```
43
43
44
44
Add the plugin to your app
45
- ``` rs
45
+ ``` rust
46
46
. add_plugin (GizmosPlugin )
47
47
```
48
48
49
49
For interactive gizmos add the following bundle when spawning your camera
50
- ``` rs
50
+ ``` rust
51
51
GizmoInteractionCamera :: default ()
52
52
```
53
53
@@ -62,37 +62,39 @@ opt-level = 3
62
62
# Usage
63
63
64
64
Draw a single gizmo
65
- ``` rs
65
+ ``` rust
66
66
draw_gizmo (gizmo );
67
67
```
68
68
69
69
Draw multiple gizmos
70
- ``` rs
70
+ ``` rust
71
71
draw_gizmos (vec! [gizmo , gizmo , gizmo ]);
72
72
```
73
73
74
74
Draw multiple gizmos and a connecting line
75
- ``` rs
75
+ ``` rust
76
76
draw_gizmos_with_line (vec! [gizmo , gizmo , gizmo ]);
77
77
```
78
78
79
79
Draw a line
80
- ``` rs
80
+ ``` rust
81
81
draw_line (points , color );
82
82
```
83
83
84
84
Draw a closed line
85
- ``` rs
85
+ ``` rust
86
86
draw_closed_line (points , color );
87
87
```
88
88
89
89
90
90
91
91
# Interactions
92
92
93
- ``` rs
93
+ ``` rust
94
94
Gizmo :: new (translation , size , color ). on_click (|| println! (" Clicked!" ))
95
95
Gizmo :: new (translation , size , color ). on_hover (|| println! (" Hovered!" ))
96
+ Gizmo :: new (translation , size , color ). on_click_system (| time : Res <Time >| ... )
97
+ Gizmo :: new (translation , size , color ). on_hover_system (| query : Query <& Transform >| ... )
96
98
```
97
99
98
100
0 commit comments