-
Notifications
You must be signed in to change notification settings - Fork 3
Overview
This page covers the four main components of GUIs in Oak Tree: Controls, Painters, RootPanelControl, and Themes.
Controls are the building blocks of your GUI and each control is specialized for certain tasks. The base control class is aptly named Control and provides basic positioning and size logic. Many subclasses of Control exist, such as ButtonControl for creating buttons and GridPanelControl for arranging children in a grid. It is also possible to extend an existing control and create your own if the existing ones do not entirely suit your purpose.
Painters provide rendering logic for your Controls. Each control can have a base ControlStyle while subclasses may have multiple styles, such as HoverControl having a style for when hovered over or SliderControl having a separate style for its slider. Oak Tree currently provides ColorPainter, TexturePainter, ItemPainter and NinePatchPainter out of the box.
RootPanelControl implements logic for handling an entire tree of Controls such as z-sorting so that you don't have to handle implementing that logic yourself.
Themes are a collection of paintes that can be applied to a RootPanelControl, which will allow the painters to be applied to all controls in your GUI. Oak Tree also provides a helper function for creating a vanilla style - which RootPanelControl uses by default - based on the vanilla Minecraft GUIs, though it is currently incomplete.