-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inputs.rs
31 lines (28 loc) · 955 Bytes
/
inputs.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use bevy::{log::LogPlugin, prelude::*};
use bevy_streamdeck::{StreamDeckInput, StreamDeckKey, StreamDeckPlugin};
fn main() {
App::new()
.add_plugins((MinimalPlugins, LogPlugin::default()))
.add_plugins(StreamDeckPlugin)
.add_systems(
Update,
(print_streamdeck_events, check_streamdeck_key_status),
)
.run();
}
fn print_streamdeck_events(mut streamdeck_input_events: EventReader<StreamDeckInput>) {
for event in streamdeck_input_events.read() {
info!("{:?}", event);
}
}
fn check_streamdeck_key_status(streamdeck_key: Res<ButtonInput<StreamDeckKey>>) {
for i in 0..50 {
// TODO: check with the number of keys on the deck
if streamdeck_key.just_pressed(StreamDeckKey(i)) {
info!("key {} just pressed", i);
}
if streamdeck_key.pressed(StreamDeckKey(i)) {
info!("key {} currently pressed", i);
}
}
}