Standard GUI API

BlitzMax Forums/MaxGUI Module/Standard GUI API

Scaremonger(Posted 2014) [#1]
I've been looking at the User Interfaces I have used throughout my projects (FryGui, MaxGui, wxWidgets, ofs, ifso plus one of my own) and all of them have different API's. I do not have one application that I could easily change the UI to something else without having to re-code huge parts of it.

Try to retrofit a GUI in one of your apps with another GUI and you'll see what I mean.

Whilst looking at my code I have made a couple of observations:

1. A game needs a different type of UI to an Office application.

Games players are used to graphical UI's and office applications work better with a UI that blends into the Operating system. On occasion you can use a Graphical UI in an Office application, but never an OS GUI in a game (it looks awful).

2. API /Interfaces.

Some GUI's are procedural and others are Object Oriented. Some have functional event handlers, others have methods or rely upon polling.

..

Regardless of what the GUI is used for or how it looks: Under the bonnet they are not interchangeable or compatible.

Does anyone know if there is a standard for design of a GUI API (Not the UI itself)?


AdamStrange(Posted 2014) [#2]
I use the GUI API for both my games and my apps - but I designed it myself for dealing with that.

Here's a breakdown of my approach:
a gui is a set of controls
a control is an object with a size (this position,size), which can change

All apps should be based on event systems
Therefore you will need an event system to handle the controls, window functions, mouse, keyboard, etc. To have a game loop you set up a timer.

Here's where the fun starts:
All GUIs have a page approach. so you will need to build that into things
A Page is a set of visible controls, so show Start page would show the into, show main game, etc

It works great for both apps and especially games which need subdivided parts (menu screen, intro screen, main game, etc)


You need to decide how to draw and respond per control, object oriented, uber list, mega case, etc.

My system handles a lot of the basic stuff - images, text, drawing, some basic controls. Each app then defines it's own controls - handles drawing, etc. In an app I seem to have between 100-200 separate new controls. A game has much less 10-30 most of them UI interaction