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

📐 Add layout constraint system #64

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

heytherewill
Copy link
Contributor

This implements a pretty basic, but extensible, layout constraint system.

Right now one can snap the UI on any of the four sides of the screen, center it vertically or horizontally and also force a width or height. We can implement relative layout and other constraints on future iterations.

I'm using the CollisionComponent as the way of indicating the size while using a PositionComponent to indicate where on the screen the UI will be rendered. Do let me know if there are better candidates for either.

Needless to say, this assumes the target batch is a UI batch, since values are based on the size of the screen and are ignoring the camera (though one could make it work by wrapping all components in a parent component that is aware of the camera and moves along with it).

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