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

Resizable Editor Window #5779

Merged
merged 7 commits into from Feb 26, 2024
Merged

Conversation

Web-eWorks
Copy link
Member

@Web-eWorks Web-eWorks commented Feb 24, 2024

At long last, we have the technology to resize a window at runtime. It only took three years by my count.

This PR provides support for resizing the editor window using the titlebar / window corners (or any other OS-provided method to resize a window). It also fixes some bugs along the way, adds some more FIXME comments (no delve into the dungeon of the code is complete without at least one new FIXME), and sneakily adds an option to resize the main game window as well - though none of the UI currently resizes along with it.

This PR fully deprecates and deletes Graphics::GetScreenHeight/Width, replacing usage with the Renderer::GetWindowHeight/Width methods instead. In a lot of cases, the original use of the function was suboptimal at best, and future work should be done to refactor those algorithms to use a more appropriate source of screen size information. I'll be leaving that for other contributors to hack on at this juncture.

Fixes #5742.

2024-02-24.00-18-02.mp4

- Listen for window resize events and recreate offscreen render target if changed
- Resizing is opt-in (to allow gradual migration of existing content)
- Renderer determines new platform drawable size in pixels
- Deprecate Graphics::GetScreenWidth/Height
- Editor window resizes by default
- Game window can be resized if setting a debug option in config for now
- All code now queries current window width/height from renderer object
- Added TODO/FIXME comments where appropriate
- Event handling is now safe to run at the start of the frame, now that there is no longer a dependency on it from OldUI
- Remove associated FIXME comments obsoleted by removal and rewrites of old systems
- Detected with valgrind's "conditional jump depends on unitialized variable" check mode
- Resolves UX issue where the user enters an extension-less filepath and expects it to automatically be treated as a JSON file
@Web-eWorks
Copy link
Member Author

Web-eWorks commented Feb 24, 2024

This PR now also partially addresses #5746 - I've fixed the missing display of the system when creating a new system, and ensured that saved system files have a .json extension.

@fluffyfreak fluffyfreak self-requested a review February 26, 2024 10:25
Copy link
Contributor

@fluffyfreak fluffyfreak left a comment

Choose a reason for hiding this comment

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

I haven't spotted any code issues, it looks good and resizeable windows!!! At long last! :D

@Web-eWorks Web-eWorks merged commit a7f2781 into pioneerspacesim:master Feb 26, 2024
5 checks passed
@Web-eWorks Web-eWorks deleted the editor-resize branch March 1, 2024 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New feature Rendering Everything related to rendering Tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Size edtor app is too large
2 participants