emoon / rust_minifb

Cross platfrom window and framebuffer crate for Rust
MIT License
1k stars 95 forks source link

ctrl-modifier does not work (main, mac-os) #289

Closed tinkerlog closed 2 years ago

tinkerlog commented 2 years ago

Hi there, it looks as if the ctrl-modifier does not work on main branch on Mac-OS. Also I don't see

The command-modifier doesn't seem to work as well, it gives the same key as un-modified. Cheers!

emoon commented 2 years ago

Hey,

I added this code

        if window.is_key_down(Key::LeftCtrl) {
            println!("LeftCtrl is down");
        }

        if window.is_key_down(Key::Enter) {
            println!("Enter is down");
        }

        if window.is_key_down(Key::Tab) {
            println!("Tab is down");
        }

        if window.is_key_down(Key::Backspace) {
            println!("Backspace is down");
        }

In the noise.rs example code and ran it on macOS and this works fine for me (i.e all keys are being reported pressed down when they are)

tinkerlog commented 2 years ago

Wow, thanks for the quick response! Works fine! I expected somehow to see the keys in the char_callback example. Haven't looked closely at the other examples, sorry.

emoon commented 2 years ago

In general I would recommend using the "regular" key_is_down/released/etc functions instead of the char_callback The callback is mainly there if you need to deal with specific Unicode characters and such.

tinkerlog commented 2 years ago

Will do, thanks!