emoon / rust_minifb

Cross platfrom window and framebuffer crate for Rust
MIT License
1.03k stars 98 forks source link

fullscreen windows #50

Closed aeosynth closed 1 year ago

aeosynth commented 6 years ago

Hi, I'd like to make windows fullscreen, thanks. I suppose currently I could manually get the screen size and set the image to that.

emoon commented 6 years ago

Hi, Currently there is no support for fullscreen no.

SuperCuber commented 6 years ago

Is there anything specific preventing it currently?

emoon commented 6 years ago

It depends a bit on how you want to implement it. There are two ways I see doing it

  1. Switch the resolution of the monitor. This is what games do, and yields better performance.
  2. Scale the screen to fit the current screen resolution.

Both of the above requires correct aspect ratio handling for the screen to look correct. Also it the style of window needs to be changed as well (so no title is shown etc)

So while there is nothing really preventing it it's a bunch of work to support on all platforms as the APIs for each platform is different and currently macOS, Linux, Windows and Redox is supported.

emoon commented 5 years ago

With all backends (except Redox perhaps) having (or soon having) GPU support adding fullscreen is a bit easier. I think what would work is just to create a top most window and the desktop size. This will tax the GPU a bit more for sure but wouldn't require changing the desktop resolution which sometimes has bad side effects (things moving around and not back to correct place and such)

Will this be fine?

aeosynth commented 5 years ago

i no longer need this

SuperCuber commented 5 years ago

I'm not exactly sure what you mean by create a top most window and the desktop size, but most games and windowing libraries provide a "true fullscreen" option which changes the monitor's resolution and also a "borderless maximized" option which is just removing all decorations and scaling the window up to the monitor's size

emoon commented 5 years ago

Yes but because minifb just renderes one fullscreen quad pretty much all GPUs can do that at full speed for your desktop resolution. So instead of actually changing the desktop resolution it would render a borderless maximized window at the current desktop res.

nyovaya commented 4 years ago

@emoon AFAIK Fullscreen mode is used to prevent compositing and thus reduce latency. So in my opinion this feature should be considered to be implemented.