nano9 0.1.0-alpha.3

A Pico-8 compatibility layer for Bevy
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use bevy::prelude::*;

pub fn on_just_pressed(key: KeyCode) -> impl Fn(Res<ButtonInput<KeyCode>>) -> bool {
    move | input: Res<ButtonInput<KeyCode>>| {
        input.just_pressed(key)
    }
}

pub fn on_just_pressed_with(key: KeyCode, modifiers: Vec<KeyCode>) -> impl Fn(Res<ButtonInput<KeyCode>>) -> bool {
    move | input: Res<ButtonInput<KeyCode>>| {
        {
            input.just_pressed(key)
                && input.any_pressed(modifiers.iter().copied())
        }
    }
}