-
-
Notifications
You must be signed in to change notification settings - Fork 46
Create a HUD!
Here you will learn how to create a HUD, which will draw stuff on-screen.
A HUD can be either created into a module, so that it can be turned on and off (like an ArmorHUD), or as an EventListener (which is usually for more, permanent stuff on-screen, like the TabGUI).
Note: An example of this is the HotbarOverlay class
This is pretty easy, all you have to do is check the EventManager page, to see how to create an EventListener and how to register it.
Once you created the EventListener class, and registered it (read the note), you can then Override the onRender2D()
method, like this
@Override
public void onRender2D(Render2DEvent event) {
}
Then to draw something on the screen, you can use the RenderUtils class, which contains methods to draw text, ItemStacks, rectangles and more.
This is exactly like creating a HUD as an EventListener, that means that you only have to create a Module (which is like creating an EventListener, but extending Module instead) and then follow the steps above.
Note: A wiki page dedicated to the ModuleManager and how to create a module is coming soon