ULTI Gui Library

Hey all, I'm working on a beginner friendly GUI library for Windows. Possibly including Linux through GTK/Wayland and OSX through Cocoa and if I find the time I'll make an Android release as well. I'm very well aware of the alternatives including wxWidgets, QT, and a hundred other libraries.

From what I've seen beginners get the short end of the stick with c++ sometimes. Setting up almost any library is a very frustrating experience- especially when you have to build a library from source for your system- and you've just learned to write your first console applications.

The library I'm making (The ULTI library) and the resources to go with it I'm aiming to make as simple as possible for the most used platforms for beginners.

I would like some suggestions from you though, here are my thoughts, I'd like your feedback and ideas if you'll offer them.


Setup

Setting up the library should be two or three steps. As it stands my library is 700kb for the library file and 80kb for the headers. It includes Networking, GUI development, File management, Json/Xml serialization, and tons of other handy functions. It also relies on system headers for networking and gui development.

Generally the setup process for most IDEs is
1. Link to the library, and dependencies using whatever mechanism the IDE needs
(Visual Studio) Project Properties > Linker > Input
(Code::Blocks) Project > Build Options > Linker Settings > Link Libraries
etc.

2. Add search directories for both the headers and library (this assumes you haven't installed them to a generic location)

3. Include the necessary headers

Most programmers who have used a library or two prefer to set things up the way they're comfortable with. But I think for new users there should be a much easier process.

Would you find it acceptable to have a program or script (open source and written in the ULTI library of course) that automatically sets up the library for common configurations? I'm thinking something along the lines of python pip. We could include generic setups for many libraries (wxWidgets, libCurl, zlib, etc) perhaps offering three alternatives:

-specific instructions on how to install a given library
-an automated process to install it to their IDE's global setup
-an automated process to install it to a given project

In addition to making the setup easy, making a simple GUI needs to be exceptionally easy. Advanced GUI features need to be available as well.

Here's some possible usage scenarios:

1. The HTML Style Method

1
2
3
4
5
ulti::gui gui(600,600);
gui.add("<sizer id='mainsizer' layout='vertical'><button id='clicker' h_weight='1'>Click Me</button></sizer>");
gui["mainsizer"].add("<text id='output' style='multiline' v_weight='1'></text>");
gui["clicker"].on("click",[this](ulti::message& msg){gui["output"].append("Hello Again!\n");});
gui.show();gui.execute();//don't close until the window is closed 


2. The C++ Style Method

1
2
3
4
5
6
7
8
9
10
11
ulti::gui gui(600,600);
ulti::sizer mainsizer(gui,ulti::VERTICAL);
ulti::button clicker(gui,"Click Me");
ulti::text output(gui,ulti::MULTILINE);
mainsizer.add(clicker);
mainsizer.add(output,1);

clicker.bind("click",[&output](ulti::message& msg){output.append("Hello Again!\n";});

gui.show();
gui.execute();


3. The MVC method, import an external file or include an external file as a resource file. Events using this method would still need to be attached in code.

4. Realtime Raw Drawing
I think for many new users having the ability to draw pixels directly to a window would be a great experience- when I first started I was very frustrated with the amount of effort it took to get to that stage.

Something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
ulti::whiteboard board(600,600);
board.show();

board.clear(0xff,0xff,0xff);
board.set(5,5,ulti::color(0xff,0x00,0x00));
board.line(10,10,50,50,ulti::color(0xff,0xff,0x00));

ulti::sprite sprite;
sprite.load("image.png");

board.draw(sprite,100,10);

ulti::input input;
while(board.getInput(input,true)){
    if (input.type==ulti::event::mouseEvent&&board.getState(ulti::mouseLeft)==1){
        board.set(input.x,input.y,0xff00ffff);
    }
    board.frame();
}


This could greatly simplify the process for new c++ developers to really get into the nitty gritty and bypass a little bit of the (unnecessary) learning curve! What do you think? What would you like to see in a new GUI framework? How would you simplify the process of library setup? What advanced GUI features would you like to see become easier?
Last edited on
What would you like to see in a new GUI framework?
Hard to tell, maybe something easier to customizable. For instance that a drop down box may contain a tree or something like that.

How would you simplify the process of library setup?
Right now I would think that CMake would be the best way to go (if i understand your request correctly)

It includes Networking, GUI development, File management, Json/Xml serialization, and tons of other handy functions.
Hmm, that feels like reinventing the wheel again. There are libraries like boost/POCO and other which are doing alread a good job regarding this.

My question would be: Does your gui contain native elements or is this all self made?

One of the most important things when using a library is the documentation. If there is non most potential users will refrain from it.
Thanks for the input coder777

My question would be: Does your gui contain native elements or is this all self made?


Everything is native, the only self made elements will be missing elements (things like dropdowns containing trees, in your example)

Hmm, that feels like reinventing the wheel again.


Fortunately this step is already complete, and necessary for the GUI library itself- specifically json/xml for element interaction.

There are three things I'm trying to balance:
1. Ease of use
2. Library/Exe size
3. Speed

Right now the most important area is obviously Ease of use because it is designed to be a beginner's library, however the last last GUI I made with the library topped out at 4MB (compared to my last bare wxWidgets exe of 10MB, I'm pretty happy with that) and everything was exactly as fast as it needs to be (trying everything out in an underclocked xp virtual machine)

The biggest challenge will probably be good documentation, I agree that is definitely an essential ingredient.

It has been quite exciting for me to work on this, it has definitely helped me grow a significant appreciation for existing libraries ^_^ it has also been pretty interesting coming up with rock solid algorithms for things like resizing (a good resizing function has quite a bit of flexibility). Perhaps it feels like reinventing the wheel, but that's because I want (need?) a different kind of wheel!
Right now the most important area is obviously Ease of use because it is designed to be a beginner's library
Ease of use has not necessarily anything to do with beginners. Beginners are usually not a good audience. Honestly I would drop that term.

compared to my last bare wxWidgets exe of 10MB, I'm pretty happy with that
I'm using wxWidgets and the release output size is something about 2MB. 10MB was likely the debug size.

it has also been pretty interesting coming up with rock solid algorithms for things like resizing (a good resizing function has quite a bit of flexibility)
What about the positioning of the controls or generally the layout?
Honestly I would drop that term.

I don't mind dropping the term, but the I will definitely still strive for the result. It's easy to forget what it's like when you're fresh, I'd like to help.

I'm using wxWidgets and the release output size is something about 2MB. 10MB was likely the debug size.

Very cool! I must be using a monolithic build or something odd then.

What about the positioning of the controls or generally the layout?

Everything is golden here, I've got minimum/maximum sizing, weights, grid layouts, margins, (I would like to add padding, but different controls are different in that regard), and child positioning, I'd like to add more resizing options- but I'm working on the realtime windows right now (actually they're done as well, I'm making a quick game today!)

Things are always more exciting when you see a finished product, if there aren't any big requests I'll just keep pounding away at it and show everyone a finished product when it's done, it's no fun talking in hypothetical terms!
Topic archived. No new replies allowed.