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?