Kiss_sdl -- Simple generic GUI widget toolkit for SDL2

To let you all know, kiss_sdl is now at https://github.com/actsl/kiss_sdl2 .

GitHub even refused to delete the entire repository, so that the old URL were available to me to upload my repository to the same URL again, in spite requested. After some person submitted a DMCA notice, because of asking help in building for Android, and after receiving help, requesting to delete the issue attachment file with the build of some files of unknown origin referred to somewhere in the Internet, that i cannot delete myself, and GitHub refused to delete that file. This is too much nonsense all at once, certainly it caused disruption. So you now know that the project it is at the new URL. I’m really sorry for the trouble it undoubtedly caused to all users, including to these 64 good people who gave a star to kiss_sdl in GitHub, trying to do all they can to promote the toolkit. Many thanks to all users of kiss_sdl, and sorry for inconvenience again.

The old thread of kiss_sdl is at Kiss_sdl - Simple universal GUI widget toolkit for SDL
-------------------------
kiss_sdl – Simple generic GUI widget toolkit for SDL2 https://github.com/actsl/kiss_sdl


The following is an example of using the widget toolkit in a game, this is a screenshot of the project https://github.com/solarHunter/solarHunter by the permit of its author.
Notice that GUI has to be simple, to not interfere with the advanced background.

2 Likes

Takedown of the repository appeared to be a mistake, the kiss_sdl repository is now back at https://github.com/actsl/kiss_sdl . The repository is good and up to date.
-----------------------
kiss_sdl - Simple generic GUI widget toolkit for SDL2 https://github.com/actsl/kiss_sdl

I think i should explain here very briefly what it is, so you would get some idea. There is immediate GUI, which you may prefer if you want a simpler and easily changeable GUI toolkit. It is also straightforward to use, so doesn’t mostly in practice make the code that uses it more complex, may make it even simpler. The original immediate GUI is imgui (also used in the OGRE game engine), the other is nuklear. kiss_sdl is what i call principal GUI, going further from immediate GUI, written only for SDL (SDL2), which makes it much simpler, it’s generic but it’s less than 2500 lines of easily changeable code. It is thus not “yet another” GUI toolkit, but one can see it only when one knows more about it.

No other generic GUI toolkit in C or C++ as much as it is known, is so simple. How much more complex are the others, is a matter of dispute, the only quantifiable measure is the number of lines of code, and they have at least 10 times more lines of code, though lines of code is certainly not the only parameter of complexity, and it can only be a parameter of complexity when there is a need to more easily change or understand the code. There are other parameters, it is also made to be easily changeable, with parts of the code also abstracted into different files, so it’s easy to change the libraries used or such. One more way how less than 2500 lines of code (normal and well written code) matters, is that it is an indication, a general and complete GUI toolkit with 2500 lines of code cannot be made with a bad design.

In spite it’s the simplest though, every GUI toolkit has some considerable learning curve. It evidently depends on one’s experience as a programmer, like some experienced programmers have learned kiss_sdl in a few hours or even in an hour. It has been made easy to learn, but it still takes some effort for a beginner. Although it is not a typical retained GUI, it is still very similar to a usual GUI toolkit what concerns the general features. Most of what you will learn though, will be general things about programming, that are important to know anyway, so learning kiss_sdl will not be a waste of time, even if you later want to use some more advanced GUI toolkit. Which you though may not need for any games, simulators, system tools or other software, that you may make, but it depends on what you want to do. For games at that you most likely need some very flexible and easily changeable GUI, whatever it may be.

Every effort has been made to make it high quality and reliable, and to eliminate all bugs or faults in the code and in compiling. For more than a year, no issue has been found, except one had a problem compiling it 64 bit in Visual Studio, it works faultlessly with 32 bit and in 64 bit Linux and macOS. I have only 32 bit Windows though, so testing it 64 bit in Visual Studio would be very welcome, and i would especially be thankful for 64 bit project files for Visual Studio, which can then be added to the repository. There is also a branch for high DPI displays and for Android, but for Android it is using ndk-build only.

Then also, is it a “niche product”, as some say? It is open source, so not a product, but it is not a niche thing, why did i need it then? No, it is a general software for its purpose. By some estimations it has more than 2000 users now, there are 1800 downloads in FreewareFiles only, so not “less than 1000” as some here have said. GitHub doesn’t show the downloads, all i know by now is 77 stars and in average 10 unique views in a day during two years. If a GUI toolkit is a “niche product”, then it has failed completely, different from other software or games, as some may not understand. Because GUI has a considerable learning curve, it thus cannot be just “tried”, and if not widely used, everyone would make a decision not to use it before trying it. But it can be said that kiss_sdl is widely used as a GUI toolkit, as GUI toolkits are not used by so many, at least for games. Which is exactly what i want to change, GUI toolkits are too complex, so that some evidently prefer to use not so good options such as command consoles instead, there is a need for a simple generic GUI toolkit.

There are excellent Lazy Foo tutorials about SDL2, but Lazy Foo has not written a tutorial about GUI and may not do it as he is a busy man. kiss_sdl shows how to write a basic GUI in much of the Lazy Foo style, so one may also consider it for learning of how to make GUI.

The reasons why some don’t like this GUI toolkit, are evidently not technical, and also not theoretical. When anyone finds any real technical or theoretical reason why this toolkit is not good for its purpose, that is simple generic (which also means general purpose and complete) GUI toolkit for SDL2, then i will be thankful and very interested to know. But replacing theoretical talk with talk against me as a person is not what i consider competent, so please nothing such or i refuse to talk. The name kiss_sdl is sure a pun intended, but this pun comes from Peter Pan. I of course meant it to mean an acronym “Keep it Small and Simple”, to emphasize that it was made by that principle. As an acronym it should properly be in capital letters though, so KISS_SDL, but as C programmers are used to write everything in lower case letters, it’s thus kiss_sdl.

All that said above, there is no need for such talk for multimedia libraries likely, as they are straightforward, important only that they perform their functions well, and the functions that they have to perform are often self-evident. GUI toolkits are different, as all there depends on how the things are tied together, they are not usable if all that is not done right, more than implementing a separate functions correctly. So a call again for a separate forum for GUI development, as the things discussed here are so different from SDL core development, and thus look unnecessary in SDL development mailing list. Any feedback from any of you is welcome.
-----------------------
kiss_sdl - Simple generic GUI widget toolkit for SDL2 https://github.com/actsl/kiss_sdl

About how to use it, for these who may not know. I will explain how to use it in MinGW, which i think most use, it’s somewhat different for Visual Studio and for other platforms. First install MinGW from there https://sourceforge.net/projects/mingw-w64 under C:\ , then add C:\mingw-w64\mingw32\bin to Path. Then install 7-zip from http://www.7-zip.org/a/7z1701-x64.exe (for 64 bit), you need it to extract tar.gz . At that remember to click on the archive name, to open the containing tar archive, and then extract, for the top directory of the repository to be the top directory of the library. The SDL2 libraries can be downloaded from https://www.libsdl.org/download-2.0.php , https://www.libsdl.org/projects/SDL_image and https://www.libsdl.org/projects/SDL_ttf , from all of these download the development libraries for MinGW. Now there are different ways of installing SDL2 libraries.

The “official” way is to extract the libraries as they are under C:\ , in the kiss_sdl makefile it is assumed that the libraries are installed in the official way. The other way is to extract the lib, include and bin directories from these libraries for x86_64 (or i686 for 32 bit) into the corresponding directories in MinGW. In that case no paths have to be written on the compiler command line, as the libraries are in standard places, with an additional benefit that all the dll-s of these libraries will be in Path too. This will be similar to how the libraries are installed in Linux, but it’s not the Windows way, as one then cannot see what libraries were installed and cannot use different versions of the libraries. After installing the libraries in the official way, either add the corresponding bin directories of the libraries to Path too, or then copy all dll-s from them to your project’s directory where your code is.

In the makefile it is assumed that the version of SDL is 2.0.7, it will be changed to later versions. If the version is any other than that, change in the makefile 2.0.7 to something else, or whatever the case may be. Also of course comment the lines in makefile for Linux and uncomment the lines for MinGW 64 bit (or 32 bit). When all that is done, the rest is simple. Go to your project’s directory in the cmd command line console, and type mingw32-make -f kiss_makefile , followed by Enter. Then typing kiss_example1.exe or kiss_example2.exe should run the examples. If you write your own makefile, just name it Makefile, and then you can simply run mingw32-make . When you use Code::Blocks, Eclipse, Dev-C++ or any other IDE, write the libraries and the paths from the compiler command line arguments for libraries and for headers (include files) from makefile to project properties somewhere, and you can build your project in the IDE.

Some say that the name kiss_sdl suggests that it is a library to use SDL in a simple way. It is partly true, indeed i found that a lot of the work i did when making kiss_sdl was really general, not special to GUI at all. But at that i thought that GUI is the most complex and thus it is the most important to make it simple. Then considering that the name has to be short, i couldn’t add anything more to it. If i had to name it to anything else, i would call it pgui, which stands for “principal gui”, but then it would not be seen from that name that it is made to be small and simple.

While there is no GUI Development forum, the most appropriate place to talk about GUI toolkits i think is the Game Development forum.
-----------------------
kiss_sdl - Simple generic GUI widget toolkit for SDL2 https://github.com/actsl/kiss_sdl

It is now updated to SDL 2.0.8 and SDL_Image 2.0.3, which means that it was also tested with these. I always try to keep it up to date.

I made it for the beginners, but now some advanced programmers are using it. Like the one who gave a star to it, also made his own compiler. I have also made my own compiler, but there are not so many programmers who have done it. I have seen some amazing GUI that was made by starting from this toolkit and by changing it, they said that they will write about it in this forum when they finish it, but they likely still keep doing it.

This GUI toolkit has now more than 100 GitHub stars. I have not posted it in any social media, so the stars were given by the users who downloaded it, tried it, and liked it. I have also talked to a dozen people who gave stars, and by that this really seems to be the case.

It has also more than 2000 downloads in Freeware Files https://www.freewarefiles.com/Kiss-sdl_program_107255.html . As it is also used for learning GUI, i consider download a use. Not many download from Freeware Files, so by moderate estimate it has been downloaded two times more from GitHub, which has no download statistics. Thus it likely has at least 6000 users. Maybe not much, but how many do use any GUI toolkit at all, not so many, a vast majority of SDL users likely don’t use any at all. Thanks to all users, this is what we will try to change.
-----------------------
kiss_sdl - Simple generic GUI widget toolkit for SDL2 https://github.com/actsl/kiss_sdl

More than 10 000 views of this and my thread in SDL Development Forum, more views than anything in these forums, except the announcement of SDL 2.0.6 release. 128 stars, 2500 downloads in Freeware Files, estimated 7000 users. Not good? Improve? No one has improved it for several years. Accept? Some say, they wrote text box in SDL for 2 weeks, i believe. But GUI toolkit is more than just a text box, it is many things that fit together.

Many thanks to all users. Some use it for weird things, like some who gave a star, used it to make a GUI interface on any 3D surface.

kiss_sdl now has 200 stars and over 3000 downloads in Freeware Files only https://www.freewarefiles.com/Kiss-sdl_program_107255.html , estimated 9000 users, thank you. Sure we will reach 10 000 users soon.

Everything, for every purpose, has only one best solution, that’s in general true. But it doesn’t necessary have to be that best solution, enough when it is very close to it. And sometimes there are several solutions very close to the best, and not a single one that is the very best.

Like in SDL, there are structures for objects, and there are structures for widgets and resources in kiss_sdl. But in every structure there, the parent of it has the type number of that object. In kiss_sdl instead, the dynamic array stores the type numbers. Both have its benefits and disadvantages. Like if all resources have such a structure, then the SDL solution is the best, but what if we want to add something to the destructor array that doesn’t have such structure. Again, two solutions close to the best, both best for some purposes.

The makefile is rather an example, the GUI toolkit is used in a project, and however you build your project, this will build this GUI toolkit as well. I could use cmake or a script to compile the examples, i have thought whether to do it or not, but this is not an end user software, even not a library, it is a code for developers, thus i don’t see that it’s necessary.

I know it’s rather inconvenient to change the paths in the makefile for newer SDL releases. But a software developer should be able to do that, and with a bit of knowledge it’s not too difficult. I thus no longer make new version after every new SDL release.

I have done that, but there has been nothing else than the paths of the SDL directories to change. For Windows, and nothing to change for Linux. There was no need for a single change in code. I therefore don’t make new releases any more, except if something would not work due to changes in SDL, that has not happened.

Some people use it for weird things yes. With SDL or some other graphics, it can be used for a user interface of all kind of embedded devices that have a screen. Thus when looking at the stars, one seemed to use it for thorium salt reactors.

Many thanks to all users again.

Fantastic man…

Is in my list now :wink:

Congratulations!

There are now 10 000 users i think, and 253 stars, if only GitHub had a statistics.

One more thing to say, kiss_sdl is a simple generic GUI toolkit. What that means is that it may be all that one needs for most who do game development, write simulators, sound software, etc. Like when one needs to do things like load a file or such, one has to learn something like Qt, that’s silly.

But that said, there are very high level frameworks. Like in the web development, one can do things like view and edit a database with three lines of code. This GUI toolkit is not so high level, and it is not intended to be.

So what GUI toolkit to use, it depends. If there is a lot of data, including big databases, then sure a GUI toolkit or a framework made for handling such extensive data, would be a better choice. The downside is mostly a rather boring look, but one cannot get both at the same time.