-
Notifications
You must be signed in to change notification settings - Fork 20
Structure
Here we provide a high level documentation of pyglui classes and elements.
The UI
class is a user interface context that must be created within a system window. We have designed pyglui to be used with glfw
, but it should also work with other window managers.
It is a manager of ui elements and the top level control layer of the UI.
UI elements can be appended to the UI context just like how you would interact with a normal list in Python. For example you can append a new menu element to the ui with ui.append(menu)
, extend the ui with ui.extend
or remove elements with ui.remove
.
Since the UI
class has access to all elements, it can also globally control attributes like scale - so that you can increase or decrease the size of each UI element with ui.scale
.
The FitBox
is the key building block...or box...of pyglui. It is used in almost every class to define a two dimensional rectangular context or 'box'. A FitBox
is defined by two 2D vectors, position (x,y)
and size (width,height)
, and fits itself into a context (hence the name fit + box). Typically the context is defined by another 'parent' FitBox, except for the case of the UI class where the context is the window created by glfw itself. We'll demonstrate this a bit later.
The position
and size
vectors of the FitBox class define how it fits into its parent context. We have prepared a few diagrams to help clarify the rules.