Skip to content
This repository has been archived by the owner on Jul 2, 2023. It is now read-only.

Add anchoring points for HUD elements and various HUD refactorings #139

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

DarkKronicle
Copy link
Contributor

@DarkKronicle DarkKronicle commented Apr 27, 2023

This implements KronHUD's 9 point anchoring system to allow for greater flexibility with dynamic sized HUD elements. This implements it as pretty much set it and forget it. It handles updating bounds whenever height and width updates so there isn't any need to worry about that. It also converts x/y values into floats that represent the percentage that they are on the screen. This makes it so resizing does not mess up the HUD.

It may be worthwhile to enable anchoring everything if someone desires if they resize a lot. The anchoring would be useful to ensure stuff stays snapped to edges.

HudElement has a new inheritor called AbstractHudElement. This is meant to make it easier to create complex HUD elements without having to make them as a mod. This is useful in my bedwars mod and the discord mod in this client.

Currently on the HUD edit screen it displays the anchors when selected. I don't know if this is the best way, so feel free to change them.

This also should ™️ automatically migrate from old storage to new. It won't be perfect since it converts to percentages, and that's probably messed up.


(most likely) Closes #128.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rework HUD implementation
1 participant