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

Decouple UI #1839

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Decouple UI #1839

wants to merge 2 commits into from

Conversation

ZehMatt
Copy link
Contributor

@ZehMatt ZehMatt commented Feb 13, 2023

A very crude proof of concept, while doing this it revealed quite a few things that should be addressed to properly support this.

  1. We need to separate the UI resolution from the resolution at where we render the game at, basically we have to separate the context between drawing a viewport and UI, both can have different resolutions.
  2. We should not store the mouse coordinates scaled, UI requires to be unscaled while for in-game we have to apply the scale before to compensate for different render resolution.
  3. The main window acted as a way to clear the pixels for where no windows is, there is a specific draw order, this poc requires to clear that in every tick causing odd flickering, I have to yet fully figure out whats causing this.
  4. The invalidation doesn't properly work with the separate UI space, UI is currently always cleared each tick, world space also has invalidation issues, this is due to how the invalidation grid works, this should be probably kept at UI resolution and then we need to transform UI to screen to check what regions are dirty.
  5. UI code has to rely on UI resolution rather than render resolution, those two things require to be separated, i've added a quick and dirty unscaledWidth/unscaledHeight function to make this work.

This PR acts more as a reference to where the problems are at.

2023-02-13_05-09-10c07308d21c3df92f4.webm

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.

None yet

1 participant