GraphUI – Easy to Use for your Desktop & Embedded Systems

Part of the Graph Type Rendering and UI Saga. After a few reviews & iterations cleaning up technical issues like bugs & performance, I couldn’t stop w/o simplifying the API itself. So here I will just describe the most simple UISeneDemo00 and will details others in upcoming blog entries including a rebuild API doc using Doxygen.

This demo and most of the other, is simply coded using the main function for simplicity. Only UISceneDemo20 as mentioned earlier uses a GLEventListener and is still heavily coded due to layouting the Shapes on the screen. However, this will be overcome soon as well using a layout container.

So we start creating a Font instance to be used for like Button and Label Shape’s and a Scene, which contains the Shapes and handles their representation (draw) as well as user interaction. For the latter, it transforms mouse screen coordinates to Shape coordinates and forwards such events while also handling drag-move and drag-resize.

Below I extracted the bare minimum to see something on the screen, i.e. a Button Shape.

final Font font = FontFactory.get(FontFactory.UBUNTU).get(FontSet.FAMILY_LIGHT, 

// Assuming normalized Scene plane size, i.e. 1.0
Shape shape = new Button(renderModes, font, "+", 0.10f, 0.10f/2.5f);

// The scene shall act as the GLEventListener, hence ass glClear*() params.
final Scene scene = new Scene();
scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | 

// The GLWindow ...
final GLCapabilities caps = new GLCapabilities(glp);
final GLWindow window = GLWindow.create(caps);
window.setSize(surface_width, surface_height);
window.addGLEventListener(scene); // here the Scene becomes displayed.


// Just for automated repaint final Animator animator = new Animator(); 
animator.start(); // Go! ;-)

// Wait until first display of the Scene occurred, incl. init() and reshape()
// This b/c our little demo just runs from main() w/o its own GLEventListener.

.. and that’s it already 😉