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

Can't resize window on X11 #395

Open
alters-mit opened this issue Jul 25, 2023 · 2 comments
Open

Can't resize window on X11 #395

alters-mit opened this issue Jul 25, 2023 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@alters-mit
Copy link

On Linux X11, request_screen_size doesn't panic (an improvement from 0.3) but it doesn't actually do anything.

@not-fl3
Copy link
Owner

not-fl3 commented Jul 25, 2023

resize.mp4
use macroquad::prelude::*;

async fn test1() {
    while !is_key_pressed(KeyCode::Space) {
        clear_background(RED);
        draw_text("Press space for next test", 20.0, 20.0, 16., BLACK);
        next_frame().await;
    }
    next_frame().await;
}

async fn test2() {
    set_fullscreen(true);
    while !is_key_pressed(KeyCode::Space) {
        clear_background(WHITE);
        draw_text("Should be fullscreen", 20.0, 20.0, 16., BLACK);
        next_frame().await;
    }
    set_fullscreen(false);
    next_frame().await;
    while !is_key_pressed(KeyCode::Space) {
        clear_background(WHITE);
        draw_text("Should be windowed again", 20.0, 20.0, 16., BLACK);
        next_frame().await;
    }
    next_frame().await;
}

async fn test3() {
    request_new_screen_size(350., 50.);
    while !is_key_pressed(KeyCode::Space) {
        clear_background(WHITE);
        draw_text("Should be a 350, 50 window", 20.0, 20.0, 16., BLACK);
        next_frame().await;
    }
    request_new_screen_size(800., 600.);
    next_frame().await;
    while !is_key_pressed(KeyCode::Space) {
        clear_background(WHITE);
        draw_text("Should be a 800, 600 window", 20.0, 20.0, 16., BLACK);
        next_frame().await;
    }
}

#[macroquad::main("test")]
async fn main() {
    test1().await;
    //test2().await;
    test3().await;
}

works on my machine :(

@not-fl3 not-fl3 added bug Something isn't working help wanted Extra attention is needed labels Jul 25, 2023
@alters-mit
Copy link
Author

I found the source of the bug. In Conf, window_resizable needs to be set to true, otherwise the window won't resize at all. The bug also goes away if there is no Conf function.

On Windows and MacOS, my Conf function, and subsequent request_new_screen_size() call, works as expected, even with window_resizable: false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants