Documentation ¶
Overview ¶
Melius is an open source GUI Library oriented around OpenGL. While developing the library, I tried to keep an immediate mode pattern in mind. Although not necessarily immediate mode, Melius can easily get a window up and running with only a few lines of code!
Also while writing the library, I took many courses on UI programming for HTML/CSS to create the perfect base for the library. I attempted to design it so that it looked good right out of the box. Obviously, the library has the capability to be styled even more, but having a good base to work with isn't too bad!
If decided that this repository does not have a wanted feature, please read our roadmap. If nothing on the roadmap portrays to adding the requested features, go ahead and add them! The community would be grateful for that feature to be added (reference pull requests).
Contains all of the widget information and properties for drawing widgets. If needed, it is possible to create a custom widget (reference docs).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterWidget ¶
func RegisterWidget(w Widget)
Allows for custom widgets to be created and registered.
Types ¶
type App ¶
type App struct { // Storage of all of the currently opened windows. Windows []Window }
The App type contains all of the functions and variables needed to edit the application's settings.
NOTE: This struct should only be created once (using the New function).
type Style ¶
type Style struct { // The overall color of the widget. Color style.Dye // The overrall color of the text on this widget. TextColor style.Dye // The border of the widget. Border style.Border // The shadow of the widget. Shadow style.Shadow // The font and font settings of the widget. Font style.Font }
A struct dedicated purely on how a widget should look.
type Widget ¶
type Widget interface { // An overriden function that can be used to draw a widget on a window. Draw(width string, height string, x string, y string) draw.DrawResult // Returns the style of the current widget. GetStyle() Style // Sets the style of the current widget. SetStyle(style Style) // Handles the input for that specific widget. HandleInput(mask input.InputMask) input.InputResult // Overrides the generated shader, allowing the user to have more control. // This is highly recommended due to the app not having to generate and cache shaders at runtime, giving a slight performance boost. OverrideShader(shader shader.Shader) draw.ShaderOverrideResult // Gets the overriden shader. // If the shader was not override, it will return empty. GetOverridenShader() shader.Shader // Checks to see if the widget has changed at all, may that be a hover, a click, etc. Changed() bool GetVertices() []float32 }
Pay attention to OverrideShader. It might come in handy!
type Window ¶
type Window struct { // Holds all of the widgets that the window should use. Widgets []Widget }
type WindowSettings ¶
type WindowSettings struct { // The position of the window in pixels Position math.Vector2Int // The size of the window in pixels Size math.Vector2Int }