File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change 1
1
//! Prints out all chars as they are inputted.
2
2
3
3
use bevy:: {
4
- input:: {
5
- keyboard:: { Key , KeyboardInput } ,
6
- ButtonState ,
7
- } ,
4
+ input:: keyboard:: { Key , KeyboardInput } ,
8
5
prelude:: * ,
9
6
} ;
10
7
@@ -15,11 +12,11 @@ fn main() {
15
12
. run ( ) ;
16
13
}
17
14
18
- /// This system prints out all char events as they come in
15
+ /// This system prints out all char events as they come in.
19
16
fn print_char_event_system ( mut char_input_events : EventReader < KeyboardInput > ) {
20
17
for event in char_input_events. read ( ) {
21
- // Only check for characters when the key is pressed
22
- if event. state == ButtonState :: Released {
18
+ // Only check for characters when the key is pressed.
19
+ if ! event. state . is_pressed ( ) {
23
20
continue ;
24
21
}
25
22
if let Key :: Character ( character) = & event. logical_key {
Original file line number Diff line number Diff line change 7
7
use std:: mem;
8
8
9
9
use bevy:: {
10
- input:: {
11
- keyboard:: { Key , KeyboardInput } ,
12
- ButtonState ,
13
- } ,
10
+ input:: keyboard:: { Key , KeyboardInput } ,
14
11
prelude:: * ,
15
12
} ;
16
13
@@ -173,7 +170,7 @@ fn listen_keyboard_input_events(
173
170
) {
174
171
for event in events. read ( ) {
175
172
// Only trigger changes when the key is first pressed.
176
- if event. state == ButtonState :: Released {
173
+ if ! event. state . is_pressed ( ) {
177
174
continue ;
178
175
}
179
176
You can’t perform that action at this time.
0 commit comments