Component-sdl2 — a small library for creating a GUI on SDL2

Hello!
This is a little not a game, I hope I can create a topic with no game :sweat_smile:

This is a small library for creating a GUI with SDL2 and C++17. It supports styling with css, as well as a component structure, which means that you can create complex components from simple ones.

The library is under development, a lot has already been implemented.

Here are some examples of interfaces:


I will be glad to hear your opinion on this, what you think about the idea of styling using css.

With best regards, Petr!

4 Likes

Update: English documentation has been added.

1 Like

Really Cool!

Continue the GoodWork!

If it Renders html tags, man…

1 Like

thank! спасибо :slight_smile:

At that time I still had very little knowledge in code parsing, so I did not touch html at all. Now I do not continue to make this library, since study takes a lot of time.
However, with current knowledge of creating compilers, I think that implementing html markup will be a fairly simple task.
Someday I will return to the creation of this library :slight_smile:

I think you don’t need html for GUI. To think, the web browsers were made wrong from the beginning. From the beginning they were supposed to be made just that, download a code from a remote computer, then run it. Such browser then could run GUI in the browser window, using an ordinary Gui toolkit. No need for html, xml is good for data transfer, but it is not good for what a web browser in general is. It is for running code downloaded from a remote computer, in a restricted way, in the browser. In the widest view it is about something the most general, running code in a remote computer. It is such general thinking, that matters.

However, is there an analogue of HTML in the ease of representing the hierarchical structure of the interface? If we take React, then using jsx the code becomes much more readable than if you write using calls to createElement.

No there isn’t, HTML and XML represent data very well. But this is not yet all that GUI is. When graphics is represented by the data structure, this is like putting carriage before the horse, and that is not so good idea.

Sorry, but I do not understand very well what you mean.

A very important task is to create a simple markup system for the interface so that its creation is simple. Of course, the best way is an editor in which you can configure everything directly and immediately see the result, but it can be very difficult to implement.

In this case, returning to the way the interface layout is presented, html + css looks like a good bunch. Taking into account the existing knowledge of many people with the basic knowledge of html + css, it allows the library to be more friendly.

You write the same html and css compile and you have a ready-made application, but in fact, it already exists in Electron, if you take into account that the browser engine is the render there.

Isn’t that exactly as GTK/Glade works?

Yes exactly, when graphics library is made a part of GUI, not GUI made using the graphics library.

I once went so far that i made a game in GTK, but no one was interested in such way of making games. As graphics is a part of the GUI, then in every iteration of the game loop there are these functions that process all the GUI. This makes everything very slow, as it takes time even when there is no GUI, or when there is not much GUI.

This is huge! Congratulations!