Skip to content

Add Fullscreen toggle#681

Merged
Lgt2x merged 11 commits intoDescentDevelopers:mainfrom
Lgt2x:fullscreen-toggle
Mar 22, 2025
Merged

Add Fullscreen toggle#681
Lgt2x merged 11 commits intoDescentDevelopers:mainfrom
Lgt2x:fullscreen-toggle

Conversation

@Lgt2x
Copy link
Member

@Lgt2x Lgt2x commented Mar 10, 2025

Pull Request Type

  • GitHub Workflow changes
  • Documentation or Wiki changes
  • Build and Dependency changes
  • Runtime changes
    • Render changes
    • Audio changes
    • Input changes
    • Network changes
    • Other changes

Description

Add a fullscreen toggle button, inspired by Piccu Engine.

Also fix a minor issue with #667 where the resolution read from the database would not be applied.

Remove unused lnxscreenmode. Some noise in the diff due to clang-format.

Screenshots (if applicable)

d3fs

Copy link
Member

@halprin halprin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bug when the game resolution is not set to your display's native resolution and you enter into a game. The viewport is surrounded by black.

Prerequisites

  1. Your game resolution setting is something smaller than your display's resolution. E.g. your display is set to 2560x1440, but the game is set to 1280x720.

Steps to Reproduce

  1. Launch game. It opens in fullscreen by default.
  2. Choose a new game from the main menu.
  3. Select a mission and start.
  4. The viewport is surrounded by black even though I have fullscreen enabled. This is incorrect.

Screenshot 2025-03-12 at 7 48 13 PM

  1. If I quit the mission at this point, even the main menu viewport is "shrunk" and surrounded by black now.
  2. This step doesn't matter whether I quit to the main menu or stayed in-game. I go into options and disable fullscreen, the game goes into window mode and fills the entire window (which is correct). If I then go back into options and re-enable fullscreen, the viewport now takes up the entire display and doesn't have the black surround (which is correct).

Expected Behavior

I expected the viewport to take up the entire display when in fullscreen mode all the time. There should never be any black surrounding the viewport while in fullscreen.

@Lgt2x
Copy link
Member Author

Lgt2x commented Mar 16, 2025

Hey @halprin , I could not reproduce the issue very reliably, I'm not sure where that comes from... I'm now forcing resolution change when entering a level, is it any better?

@Lgt2x Lgt2x force-pushed the fullscreen-toggle branch from 4cde879 to 1795c5f Compare March 16, 2025 18:35
@halprin
Copy link
Member

halprin commented Mar 16, 2025

It is not any better. :(

@halprin
Copy link
Member

halprin commented Mar 16, 2025

If it helps, I'm happy to jump into Discord and share my screen to show what I'm experiencing.

@Lgt2x
Copy link
Member Author

Lgt2x commented Mar 16, 2025

I had only tested on Linux and Windows, and it turns out it's a MacOS specific bug... I'll setup a Mac debugging environment and try to fix it.

Unrelated, but do you also get systematic assertions in the sound mixer on mac in debug builds? I get

Assertion failure at Initialize (/Users/louis/dev/Descent3/sndlib/mixer.cpp:54), triggered 1 time:
 'false'

I never get those on other platforms

[EDIT] probably my junky VM mac setup

@halprin
Copy link
Member

halprin commented Mar 16, 2025

Unrelated, but do you also get systematic assertions in the sound mixer on mac in debug builds? I get

Assertion failure at Initialize (/Users/louis/dev/Descent3/sndlib/mixer.cpp:54), triggered 1 time:
 'false'

I never get those on other platforms

[EDIT] probably my junky VM mac setup

Just to confirm, I do not get this assertion error.

@Lgt2x
Copy link
Member Author

Lgt2x commented Mar 18, 2025

Okay it should be better now, I fixed a few bugs related to resolution change and full-screen mode, in game and on the menu.

@halprin
Copy link
Member

halprin commented Mar 18, 2025

Okay it should be better now, I fixed a few bugs related to resolution change and full-screen mode, in game and on the menu.

Works for me!

Albeit, I found one more bug. I don't know if it is Mac specific. While in mission, change the resolution and the full screen option. Click Done. It looks like the resolution changes, but the full screen choice doesn't take effect.

@Lgt2x
Copy link
Member Author

Lgt2x commented Mar 21, 2025

Nice! I fixed the problem you mentionned

@halprin
Copy link
Member

halprin commented Mar 21, 2025

Nice! I fixed the problem you mentionned

Almost there! The resolution and fullscreen changes together now, but the window size (when in window mode) does not. If I disable fullscreen and reduce the resolution a lot (just so it is easy to see a difference), the window does not shrink to match the resolution.

@Lgt2x
Copy link
Member Author

Lgt2x commented Mar 22, 2025

There is something weird with the MacOS windowing system, again... That's the only system where I could reproduce the problem you describe. When setting to windowed from fullscreen and lowering the resolution, my laggy VM seems to first show the shadow of a 800x600 window (the resolution I selected), but then it grows back to its original size. Then, if I enter the menu and exit it, the window is rescaled properly.

If I add a delay between switching to windowed mode and changing the resolution, to give it the time to set up properly, the resolution of the window is correct. Maybe there is something to do to make sure that the fullscreen mode is correctly exited before changing resolution (window event)?

@Lgt2x Lgt2x force-pushed the fullscreen-toggle branch from 7900a35 to 5755ba8 Compare March 22, 2025 01:10
@Lgt2x Lgt2x force-pushed the fullscreen-toggle branch from 5755ba8 to b976846 Compare March 22, 2025 01:13
@Lgt2x
Copy link
Member Author

Lgt2x commented Mar 22, 2025

This is a very "RTFM" moment 😄 just had to sync the window. Fixed! I hope that does not break anything else. I'll do the 3-OS thorough testing tomorrow.

Copy link
Member

@halprin halprin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything works!

@halprin
Copy link
Member

halprin commented Mar 22, 2025

Thanks for working out the Mac exclusive issues! I super appreciate it.

this avoids brief flickering when exiting the menu without changing resolution
@Lgt2x Lgt2x merged commit 55827d4 into DescentDevelopers:main Mar 22, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants