Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for numpad #44

Closed
dancavolix opened this issue Apr 30, 2024 · 2 comments
Closed

Support for numpad #44

dancavolix opened this issue Apr 30, 2024 · 2 comments

Comments

@dancavolix
Copy link
Contributor

Hi. First of all, congrats on the project. Amazing stuff. It does what it proposes and is also very easy for beginners like me to learn how to use. I'm currently using it on a project of mine.

So, I've noticed a lack of support for the numerical keys on the numpad. On further inspection, this happens because they aren't listed in the Key enum in src/keyboard.rs

pub enum Key {
    // --snip--
    Num0,
    Num1,
    Num2,
    // --snip--

and below, on the same file,

fn transform_device_key(device_key: &dq::Keycode) -> Key {
        match device_key {
            // --snip--
            dq::Keycode::Key0 => Key::Num0,
            dq::Keycode::Key1 => Key::Num1,
            dq::Keycode::Key2 => Key::Num2,
            // --snip--

So in order to add numpad support, it is just a matter of listing the NumpadX key enumeration and later, inside the function, add dq::Keycode::NumpadX => Key::NumpadX for each key. Since these changes were so simple, I've already implemented them in this fork. I've also added them as motion key alternatives in the space invaders example.

@lemunozm
Copy link
Owner

lemunozm commented May 7, 2024

Hi!

Thanks for adding them! It would be awesome to have these changes in the main repository. Do you want to open a PR with it?

@lemunozm
Copy link
Owner

lemunozm commented May 28, 2024

Done in #45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants