[LEGUI] - GUI library for LWJGL

LEGUI is GUI implementation for using with LWJGL3.

This gui library made for using with OpenGL port (LWJGL) to allow programmers fast and easy integrate user interface to their OpenGL apps written in Java or Kotlin.
API is close to Swing API so it makes possible to fast develop UI.

Have binding system that allows to store ui in JSON representation. XML format will be supported little bit later.

Implemented features:

  • Components
  • Event system
  • Intersection system
  • Animation system
  • CSS-like style system
  • Layout system (components position depending on styles. ex: flex)
  • Layer system (allows create dialogs and tooltips)

List of implemented components:

[tr]
[td]Button[/td]
[td]CheckBox[/td]
[td]Dialog[/td]
[td]Frame[/td]
[td]ImageView[/td]
[/tr][tr]
[td]Label[/td]
[td]Panel[/td]
[td]PasswordInput[/td]
[td]ProgressBar[/td]
[td]RadioButton[/td]
[/tr][tr]
[td]
ScrollablePanel[/td]
[td]ScrollBar[/td]
[td]SelectBox[/td]
[td]Slider[/td]
[td]TextArea[/td]
[/tr][tr]
[td]TextInput[/td]
[td]ToggleButton[/td]
[td]Tooltip[/td]
[td]Widget[/td]
[td][/td]
[/tr]

Now it have OpenGL 3.2+ compatible renderer.

You can find more information on GitHub page: LEGUI

Usage example:

https://camo.githubusercontent.com/8dcd56ad9a0d51ae82e34dc5bf4c3c18fd9c47e1/68747470733a2f2f696d6167652e70726e747363722e636f6d2f696d6167652f7a4e424133325a6b54515f6b624a6359704c73616f412e706e67

I took a few moments to zip through the code, looks well thought out and clean. Good job. LWJGL, and java GL in general, is in need of good UI libraries.

Thank you man. Feel free to suggest new features!
Also if you want to contribute you can create PR with your changes! ::slight_smile:

Also currently starting work on CSS-like styles. (In ideal it should be similar to CSS as much as it can).

In future layout system would be configured only with styles.

Hello everyone!

I want to share with my progress…
Finally added CSS-like styles and created style based layouting.

  • Display:[list]
    [li]MANUAL
    - FLEX
    - NONE

[/li]

  • Position(for now used only for FLEX display):
    [li]ABSOLUTE
    - RELATIVE

[/li]
[/list]

Also added shadows support and several themes.

[tr][td]

https://preview.ibb.co/jsG4Vd/Dc63_KSPX4_AIEIc7.png

[/td][/tr]

Source code you can find here: https://github.com/LiquidEngine/legui
Discord server: https://discord.gg/6wfqXpJ

Looks great!

Added FBOImage and usage demo.
Available under 1.4.5-203 version in https://raw.github.com/LiquidEngine/repo/develop repository.

Added scrollbars to text area…
(Available under 1.4.5-217 develop build)

Currently working on abstraction for users that need only UI features.

Now this available under 1.4.5-FEATURE-window-manager_6 version, so you can try it and say what would be nice to add…
Repo url for feature build: https://raw.github.com/LiquidEngine/repo/feature

Usage example:



import org.liquidengine.legui.component.Button;
import org.liquidengine.legui.component.Label;
import org.liquidengine.legui.event.MouseClickEvent;
import org.liquidengine.legui.listener.impl.AbstractMouseClickEventListener;
import org.liquidengine.legui.system.LeguiSystem;
import org.liquidengine.legui.system.Window;

public class LeguiSystemUsageDemo {

    public static void main(String[] args) {
        System.setProperty("joml.nounsafe", Boolean.TRUE.toString());
        System.setProperty("java.awt.headless", Boolean.TRUE.toString());

        LeguiSystem.initialize();

        Window window = LeguiSystem.createWindow(800, 600, "HELLO");
        window.setVisible(true);

        createGUI(window);

        Window finalWindow = window;
        finalWindow.addCloseEventListener(event -> {
            System.out.println("CLOSE EVENT");
            LeguiSystem.destroyWindow(finalWindow);
            LeguiSystem.destroy();
        });
    }

    private static void createGUI(Window window) {
        final Integer[] clickedTimes = {0};

        Button button = new Button("Button", 10, 20, 100, 30);
        Label l = new Label(getText(clickedTimes[0]), 10, 60, 100, 30);

        button.getListenerMap().addListener(MouseClickEvent.class, new AbstractMouseClickEventListener() {
            public void onClick(MouseClickEvent event) {
                clickedTimes[0]++;
                l.getTextState().setText(getText(clickedTimes[0]));
            }
        });

        window.getFrame().getContainer().add(button);
        window.getFrame().getContainer().add(l);
    }

    private static String getText(Integer clickedTimes) {
        return "Button clicked: " + clickedTimes;
    }
}