HUD Basics
Learn about the HUD system OneConfig has to offer
What are HUDs?
HUDs are small pieces of information rendered on the player's screen which can display all kinds of things, from images to coordinates. These use an extensive positioning and scaling system built into OneConfig, and this helps us achieve our goal of being able to edit everything for every mod in one place.
OneConfig HUDs are extremely easy to use, with little code needed to create a HUD, and positioning, scaling and everything else handled behind the scenes by OneConfig!
Huds are essentially an extension to the Config system, with a few extra methods, and follow the same syntax for adding additional configuration options to your hud, using annotated fields. (see Creating a Config)
Creating a HUD
To create a HUD, all you have to do is extend the class you would like. OneConfig by default has SingleTextHud and TextHud for premade, text only HUDs. These are purely convenience classes which offer an easier way for the most common type of HUD.
This guide will focus on creating a simple HUD that extends SingleTextHud, but if you want to create a more advanced HUD, you should use the BasicHud class instead.
For more information on how to create more advanced HUDs, and to see the wealth of methods that the BasicHud has to offer, make sure to checkout its javadocs, and the test.huds package of OneConfig.
Using a HUD
Now you have created a HUD class, you can use it by adding it as a field to your main config class, with the @HUD annotation, just like this:
Simple right? I hope this has given you a basic understanding of how HUDs work in OneConfig, and why they are useful and how powerful they are to use!
Last updated