File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,33 @@ fn main() {
11
11
// filter: "wgpu=warn,bevy_ecs=info".to_string(),
12
12
..default ( )
13
13
} ) )
14
+ . add_systems ( Startup , setup)
14
15
. add_systems ( Update , log_system)
15
16
. add_systems ( Update , log_once_system)
17
+ . add_systems ( Update , panic_on_p)
16
18
. run ( ) ;
17
19
}
18
20
21
+ fn setup ( mut commands : Commands ) {
22
+ commands. spawn ( Camera2dBundle :: default ( ) ) ;
23
+ commands. spawn ( TextBundle {
24
+ text : Text :: from_section (
25
+ "Press P to panic" ,
26
+ TextStyle {
27
+ font_size : 60.0 ,
28
+ ..default ( )
29
+ } ,
30
+ ) ,
31
+ ..default ( )
32
+ } ) ;
33
+ }
34
+
35
+ fn panic_on_p ( keys : Res < ButtonInput < KeyCode > > ) {
36
+ if keys. just_pressed ( KeyCode :: KeyP ) {
37
+ panic ! ( "P pressed, panicking" ) ;
38
+ }
39
+ }
40
+
19
41
fn log_system ( ) {
20
42
// here is how you write new logs at each "log level" (in "least important" to "most important"
21
43
// order)
You can’t perform that action at this time.
0 commit comments