-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Fix Embedded Game Size #101807
Fix Embedded Game Size #101807
Conversation
e2c2f64
to
75bfcd6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Embedded window scaling seems to be working fine.
- Floating window placement is placed inconsistently. Note: I think this mode should be redone in exactly opposite way of the current implementation, toolbar embedded into a game process or floating near it, this will make it much more usable.
- I'm not sure about scaling mode icons, stretch mode icon is a bit different from other icons and keep ratio icon is not intuitive, maybe something like this:
or
I find myself agreeing more and more with this idea every time I work with the floating window. It would offer several benefits, such as compatibility with macOS, support for multiple game instances, and preserving the standard game window layout. After careful consideration, I see three possible approaches: 1. Transforming the current floating window into a small toolbar window that moves with the game window:Pros:
Cons:
2. Using a floating toolbar window near the game window that belongs to the game process:Pros:
Cons:
3. Embedding the toolbar as a panel overlay within the game window:Pros:
Cons:
Anyway, I think that should be a separate PR and probably a proposal. |
d21b81e
to
1c43920
Compare
editor/plugins/game_view_plugin.cpp
Outdated
case EMBED_NOT_AVAILABLE_MINIMIZED: | ||
state_label->set_text(TTR("Game embedding not available when the game starts minimized.")); | ||
break; | ||
case EMBED_NOT_AVAILABLE_MAXIMIZED: | ||
state_label->set_text(TTR("Game embedding not available when the game starts maximized.")); | ||
break; | ||
case EMBED_NOT_AVAILABLE_FULLSCREEN: | ||
state_label->set_text(TTR("Game embedding not available when the game starts in fullscreen.")); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 3 modes could have a string appended at the end to suggest the use of feature tags to override the window mode when running the project from the editor:
Consider overriding the window mode project setting with the
editor
feature tag to Windowed to use game embedding while leaving the exported project intact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, it works as expected. Code looks good to me. Thanks a lot for tackling those issues; combined with #101809, this fixes most of the usability regressions I noticed on my end when using game window embedding.
Note that it's still possible for the viewport size to be smaller than the project settings when using the mode that uses the viewport size from the project settings, but I think this makes sense for situations where you use a high base viewport size to cater to 4K displays (but are not using a 4K display yourself).
1c43920
to
26d2e15
Compare
26d2e15
to
ae0b7ff
Compare
Thanks! |
Thank you @Hilderin ! |
This PR fixes multiple issues related to the game window size when embedding is enabled.
The main challenge was to find a way to support a mode where the game size stretches to fit the Game Workspace when developing games where the window size is not crucial, while also supporting a fixed size when it is important.
The solution I suggest is to add a new fixed-size mode. In this mode, even if the Game Workspace is larger, the window size defined in the project settings will be used. This mode is now the default.
Additionally, the Floating Window did not respect the project and editor settings for window size and placement. This PR modifies the Floating Window to have an initial size that accounts for the controls and margins of the Game Workspace. As a result, upon starting, the Game Window should always align with the project/editor settings. A side effect of this modification is that the position and size of the Floating Window will be reset with each run.
I was unsure what to do with minimized, maximized, and fullscreen modes. For now, embedding is not disabled when these modes are enabled. The game will start as usual.