deltaphc / raylib-rs

Rust bindings for raylib
Other
739 stars 133 forks source link

Cannot make it work with HiDPI #87

Open nicolaracco opened 3 years ago

nicolaracco commented 3 years ago

I cannot make raylib-rs play with an HiDPI screen. Running this simple code:

let (mut rl, thread) = raylib::init()
        .size(1280, 720)
        .title("Hello, World")
        .build();
    rl.get_window_state()
        .set_window_highdpi(true);

produces a very small window on the screen. I asked for help in the #raylib channel in discord, and they said the SetConfigFlag(FLAG_WINDOW_HIGHDPI); should be executed before creating a window, not after.

So, if what they said is true, it seems this setting should be part of the RaylibBuilder. I tried to clone the repo and tinker with it with the purpose of testing this information and submitting a PR but for some reason (surely my poor experience with rust) I cannot even run the tests without receiving compilation errors.

nicolaracco commented 3 years ago

Following the suggestion of a user on discord, I tried doing the following:

    unsafe {
        raylib::ffi::SetConfigFlags(raylib::consts::ConfigFlag::FLAG_WINDOW_HIGHDPI as u32);
    }
    let (mut rl, thread) = raylib::init()
        .size(1280, 720)
        .title("Hello, World")
        .build();

which did the trick. So it definitely should be set before creating the window :)

ImreLovasz commented 2 years ago

Unfortunately, it's not working anymore.

58 |         raylib::ffi::SetConfigFlags(raylib::consts::ConfigFlag::FLAG_WINDOW_HIGHDPI as u32);
   |                                                     ^^^^^^^^^^ could not find `ConfigFlag` in `consts`

Update It's actually ConfigFlags.