not-fl3 / macroquad

Cross-platform game engine in Rust.
Apache License 2.0
3.23k stars 313 forks source link

windowed fullscreen / maximize #386

Open bsikar opened 2 years ago

bsikar commented 2 years ago

I was thinking that it would be really nice to have a field in macroquad::window::Conf where you could specify windowed_fullscreen or maximize which would make the window start maximized. I know that in the crate coffee there is a field in their window settings where you can maximize their window: coffee::graphics::WindowSettings, but I would love to have this implemented in macroquad since I prefer macroquad to any other lightweight game engine.

frozenranger commented 2 years ago

does this help?

fn window_conf() -> Conf {
    Conf {
        window_title: "My game".to_owned(),
        fullscreen: true,
        //window_height: 500,
        //window_width: 500,
        ..Default::default()
    }
}

#[macroquad::main(window_conf)]
async fn main() {

}
bsikar commented 2 years ago

That does not help because that makes the window fullscreen instead of windowed. Making a window windowed is different. A fullscreen window fills the entire screen and its fixed in place while a windowed screen will fill the entire screen, but you can move the window around (just not resize it).

I was thinking that it would be nice to have a window which fills to the dimensions of a monitor, but you can still move the window around. Something like this could work, but it isn't ideal.

use macroquad::prelude::*;

#[macroquad::main(window_conf)]
async fn main() {}

fn window_conf() -> Conf {
    Conf {
       window_height: get_max_screen_height(),
       window_width: get_max_screen_width(),
       window_resizable: false,
       ..Default::default()
    }
}

get_max_screen_height() and get_max_screen_width() would have to be something internally in macroquad (well I guess miniquad). Maybe I should close this issue and open it up on the miniquad repo since Conf is from miniquad?

bsikar commented 2 years ago

Any updates?

bsikar commented 2 years ago

bump