The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Which GUI to use with SDL2?
SDLer


Joined: 10 Aug 2013
Posts: 9
I want a multiplatform GUI to use with SDL2 for my game, but I have trouble finding a good one. I would prefer something that is easy to integrate and comes with some kind of tutorial on how to integrate with SDL2.

So far I've looked into:

CEGUI ( I found tutorial for SDL, but not sure if it'd work good with SDL2, anyone tried it ? )
QT ( doesn't look to be a good solution, from what I could read )
LibRocket ( I am not good with CSS or HTML5, so preferably not this one ).

Is there any other option? / anyone have any idea, what is the most recently released games written in SDL using ?
Which GUI to use with SDL2?
i8degrees


Joined: 22 Nov 2014
Posts: 39
Hi there,

I haven't had the chance to try nanogui-sdl [1] out yet, but it looks really nice.

1. https://github.com/dalerank/nanogui-sdl

Quote:
On 2016/01-23 12:36:07, SDLer wrote:
I want a multiplatform GUI to use with SDL2 for my game, but I have trouble finding a good one. I would prefer something that is easy to integrate and comes with some kind of tutorial on how to integrate with SDL2.

So far I've looked into:

CEGUI ( I found tutorial for SDL, but not sure if it'd work good with SDL2, anyone tried it ? )
QT ( doesn't look to be a good solution, from what I could read )
LibRocket ( I am not good with CSS or HTML5, so preferably not this one ).

Is there any other option? / anyone have any idea, what is the most recently released games written in SDL using ?


Quote:
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
actsl


Joined: 09 Feb 2016
Posts: 83
Now there is one more.

kiss_sdl - Simple universal GUI widget toolkit for SDL

See my thread about it.

GitHub project page https://github.com/actsl/kiss_sdl

The screenshot is smaller than the actual window.

MrTAToad


Joined: 13 Feb 2014
Posts: 205
Location: Chichester, England
Does it have combo and edit boxes ?

This would be a better option than Nano (which is dependant on other routines), if it was more complete.
MrTAToad


Joined: 13 Feb 2014
Posts: 205
Location: Chichester, England
Does it have combo and edit boxes ?

This would be a better option than Nano (which is dependant on other routines), if it was more complete.
actsl


Joined: 09 Feb 2016
Posts: 83
It has edit boxes, that is entry boxes, but no combo boxes. Combo boxes can be made from an entry box, text box and a scrollbar.

Mostly, the aim of that project, is to show how to write your own graphical user interface, whatever you like, in the most minimalist way and with the simplest code. I implemented only the most minimal set of widgets, yet the ones from which most interfaces can be made. Because if i did not make it the most minimal, then the question arises, what would be more minimal. It is the minimalist approach for writing graphical user interfaces. And written completely from scratch by me, some others are written from code taken from other widget toolkits.

Try to change the code, you see how easy it is, you can do what you want.
actsl


Joined: 09 Feb 2016
Posts: 83
May i suggest something? SDL should have functions that make writing such graphical user interfaces easier. Especially a general variable size pointer array, with one or several id-s and a reference count. There are such arrays in C++, but in case if one wants to write it in C. There is now pointinrect, but also functions for making a rectangle and making a color. A more advanced string copying function that enables to copy several strings with a size restriction. A function to render texture and a function to make a texture from text. These general functions amount to 1/3 of the code of the entire widget toolkit.
MrTAToad


Joined: 13 Feb 2014
Posts: 205
Location: Chichester, England
Do you have a Windows test executable available ?
mr_tawan


Joined: 13 Jan 2014
Posts: 161
actsl wrote:
May i suggest something? SDL should have functions that make writing such graphical user interfaces easier. Especially a general variable size pointer array, with one or several id-s and a reference count. There are such arrays in C++, but in case if one wants to write it in C. There is now pointinrect, but also functions for making a rectangle and making a color. A more advanced string copying function that enables to copy several strings with a size restriction. A function to render texture and a function to make a texture from text. These general functions amount to 1/3 of the code of the entire widget toolkit.


AFAIK SDL2 is pretty barebone (which is good). It does provide the basic level of graphics, audio, etc. Incorporating higher level of functions may not actually fit the design goal of SDL.

I think the more appropriate way to implement these functionalities is to have a support library performing these tasks, not by SDL itself. For example, SDL_ttf could be use to render strings. For memory management... I think you could bring in some other 3rd-party library as well. (I think we have SDL_RenderRect/FillRect for rectangle, right ?)

Also as for the GUI toolkit, it's probably better to abstract away from calling SDL's functions directly. I mean some of us use Renderer API, some don't (they might do GL, GLES, VK, etc.). Having another abstraction layer would make the library useful in both situations.

Just my two cents.

PS. Personally I'm using a more-complex language that requires shaping (Thai, that is), so SDL_ttf is out of question. I have to implement my own text rendering, by not only using FreeType for rendering, but Harfbuzz for shaping as well. If SDL_ttf is actually built-in, I'd turn away and use some other API instead (as I already did with Cocos2dx and SFML, to name a few. I have tried re-implementing my own with these API and it was worse than nightmare.). Anyway text shaping is overkill for a many people, but it's essential for many others. It does have performance impact as well. ... Well let's save the off-topic to a later day.
Which GUI to use with SDL2?
ancientli


Joined: 01 Jul 2015
Posts: 45
https://github.com/freeors/Rose

Rose is a corss-platform C++ SDK. It is based on SDL, and provide higher level interface to application.
Features
•Cross-platform, include Windows, iOS, Android, Mac OS X, Linux. They are same as SDL.
•Running application needn't additional plugin on all platform.
•Really achieve "one code and run all platform".
•Has a platform-independent, full widget's window system.
•More detailed framework, deep into unit level on "Big Map".
•Powerful animation.
•Easy to use network interface.
•Built-in mini-app module. Chat etc.
SDLer


Joined: 10 Aug 2013
Posts: 9
actsl wrote:
Now there is one more.

kiss_sdl - Simple universal GUI widget toolkit for SDL

See my thread about it.

GitHub project page https://github.com/actsl/kiss_sdl

The screenshot is smaller than the actual window.



Thanks, this looks very promising! Might be exactly what I was looking for. Will you keep developing it, or do you feel you are "done" ?
actsl


Joined: 09 Feb 2016
Posts: 83
Thank you. I'm rewriting it right now, there is a lot to do. I think it will have a window, label, entry box, text box, vertical scrollbar, horizontal scrollbar, progress bar, button, select button, and combo box. Yet i try to keep it as minimalist as possible, like this time i'm not going to add more editing than deleting the text, typing and backspace. I would make everything smaller, so that the example will become a 640x480 window, from 1024x768 window, the widgets were much too large. I will also make it to work in Visual Studio, the Visual Studio Express 2013 is all i have.

Mr_tawan, thank you too. Abstraction layers, yes, i'm going to split it to several files, and no external library function will be called directly from the functions of the widgets. So rewriting the files for general functions may enable to use other external libraries, like shaped fonts, which you mentioned. The most i want it to be flexible, so that it does not restrict whatever is want to be done. That it mostly provides the core of a widget toolkit. More than it being advanced or complex.

As i understand, at present there are two widget toolkits for SDL2, mine and SDL_widgets, unless more would be found. SDL_widgets is witten in C++, while mine is written in C. SDL_widgets is very advanced, it is amazing how advanced toolkit they could write with 3000 lines of code. I like it a lot, a great work done, but it is not quite what i want to do. It is not written from scratch like mine, this makes it to depend too much on some other code. It is also at least two times as complex as mine, likely even after i add everything that i'm going to add. Yet still as i said, it is still amazingly short for the things it does. And it is not made the way i would like to make a widget toolkit.

So bear with me, rewriting it takes some time, there is a lot to do.
MrTAToad


Joined: 13 Feb 2014
Posts: 205
Location: Chichester, England
Thats good to hear. There are number of problems with SDL_widget, which yours should solve!
SDLer


Joined: 10 Aug 2013
Posts: 9
actsl wrote:
Thank you. I'm rewriting it right now, there is a lot to do. I think it will have a window, label, entry box, text box, vertical scrollbar, horizontal scrollbar, progress bar, button, select button, and combo box. Yet i try to keep it as minimalist as possible, like this time i'm not going to add more editing than deleting the text, typing and backspace. I would make everything smaller, so that the example will become a 640x480 window, from 1024x768 window, the widgets were much too large. I will also make it to work in Visual Studio, the Visual Studio Express 2013 is all i have.

Mr_tawan, thank you too. Abstraction layers, yes, i'm going to split it to several files, and no external library function will be called directly from the functions of the widgets. So rewriting the files for general functions may enable to use other external libraries, like shaped fonts, which you mentioned. The most i want it to be flexible, so that it does not restrict whatever is want to be done. That it mostly provides the core of a widget toolkit. More than it being advanced or complex.

As i understand, at present there are two widget toolkits for SDL2, mine and SDL_widgets, unless more would be found. SDL_widgets is witten in C++, while mine is written in C. SDL_widgets is very advanced, it is amazing how advanced toolkit they could write with 3000 lines of code. I like it a lot, a great work done, but it is not quite what i want to do. It is not written from scratch like mine, this makes it to depend too much on some other code. It is also at least two times as complex as mine, likely even after i add everything that i'm going to add. Yet still as i said, it is still amazingly short for the things it does. And it is not made the way i would like to make a widget toolkit.

So bear with me, rewriting it takes some time, there is a lot to do.


Ok, please keep us updated, I guess I would probably use this!
actsl


Joined: 09 Feb 2016
Posts: 83
The kiss_sdl widget toolkit is now improved a lot. It now has a window, multiline label, button, select button, vertical scrollbar, horizontal scrollbar, progress bar, entry box, textbox, and a combo box. All calls to external library functions from the widget functions are abstracted to separate source files, kiss_draw.c, kiss_general.c, and kiss_posix.c. By rewriting these functions, the implementation of the general operations can be changed, and different external libraries can be used. It now also works in Visual Studio, it was tested with the Visual Studio Community 2015. The new version 0.8.0 is in GitHub now.

https://github.com/actsl/kiss_sdl

The size of the screenshots below is now exactly how they appear on the screen.



Which GUI to use with SDL2?
gormlai


Joined: 16 Jul 2012
Posts: 34
Location: United Kingdom
Do you have any example skins and screenshots where kiss_sdl have been themed to a game or application? 
All the best,
Gorm

————————————————————
Founder of Kotori Studios - kotoristudios.com
Personal Twitter: @gormlai
Phone: [url=tel:%2B44%20%280%29%20744%20911%205342]+44 (0) 744 911 5342[/url]
LinkedIn: https://www.linkedin.com/in/gormlai





2016-03-28 12:59 GMT+01:00 actsl:
Quote:
The kiss_sdl widget toolkit is now improved a lot. It now has a window, multiline label, button, select button, vertical scrollbar, horizontal scrollbar, progress bar, entry box, textbox, and a combo box. All calls to external library functions from the widget functions are abstracted to separate source files, kiss_draw.c, kiss_general.c, and kiss_posix.c. By rewriting these functions, the implementation of the general operations can be changed, and different external libraries can be used. It now also works in Visual Studio, it was tested with the Visual Studio Community 2015. The new version 0.8.0 is in GitHub now.

https://github.com/actsl/kiss_sdl

The size of the screenshots below is now exactly how they appear on the screen.







kiss_sdl - Simple universal GUI widget toolkit for SDL2 https://github.com/actsl/kiss_sdl


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

actsl


Joined: 09 Feb 2016
Posts: 83
It has not been used in any game or application yet.
Re: Which GUI to use with SDL2?
actsl


Joined: 09 Feb 2016
Posts: 83
gormlai wrote:
Do you have any example skins and screenshots where kiss_sdl have been themed to a game or application?

It has been used for that game https://www.youtube.com/watch?v=ZkNVwCtkN7M and likely others. For more see the thread about it http://forums.libsdl.org/viewtopic.php?t=11772&sid=613d3f6d1a4c5ee67345ae670df1fa7e .
Which GUI to use with SDL2?
gormlai


Joined: 16 Jul 2012
Posts: 34
Location: United Kingdom
Just to follow up. We decided on using imgui, as it makes incredibly to insert your own renderer and we have to support several rendering platforms (opengl, metal, and possibly more)
All the best,
Gorm

————————————————————
Founder of Kotori Studios - kotoristudios.com
Personal Twitter: @gormlai
Phone: [url=tel:%2B44%20%280%29%20744%20911%205342]+44 (0) 744 911 5342[/url]
LinkedIn: https://www.linkedin.com/in/gormlai





2016-08-18 6:47 GMT+01:00 actsl:
Quote:



gormlai wrote:

Do you have any example skins and screenshots where kiss_sdl have been themed to a game or application?



It has been used for that game https://www.youtube.com/watch?v=ZkNVwCtkN7M and likely others. For more see the thread about it http://forums.libsdl.org/viewtopic.php?t=11772&sid=613d3f6d1a4c5ee67345ae670df1fa7e .



kiss_sdl - Simple generic GUI widget toolkit for SDL2 https://github.com/actsl/kiss_sdl


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Re: Which GUI to use with SDL2?
actsl


Joined: 09 Feb 2016
Posts: 83
gormlai wrote:
Just to follow up. We decided on using imgui, as it makes incredibly to insert your own renderer and we have to support several rendering platforms (opengl, metal, and possibly more)

Do you use what is named "dear imgui"? It depends on what you need. imgui is also an immediate GUI, the same as kiss_sdl. It is the first immediate GUI made, as much as i know.

imgui is much bigger and much more complex than kiss_sdl, and as i look at the examples, it is not for SDL2. kiss_sdl is much simpler and easier to use, also easily modifiable. I think this is what most beginners want, as a GUI widget toolkit is always difficult to learn, and starting from a more complex one makes it even more difficult. But learning kiss_sdl gives knowledge to later use other immediate GUI widget toolkits, such as imgui.

Easily modifiable is also very important. Like kiss_sdl has already been used for high DPI displays, though i'm not sure whether for all types of these yet, this is very important. As much as i know they tried to modigy imgui for high DPI as well, but only in opengl mode, and i don't know whether successfully yet.

But again as i have said, it depends on one's needs, and thus i don't think that these widget toolkits compete with each other, i think they are in different categories for different needs.

Good luck to you using imgui, and what i certainly agree with, is that an immediate GUI is the most right choice for widget toolkit for games.
dalerank


Joined: 27 Apr 2015
Posts: 6
Hello, i added nanogui fork without dependecies (eigen, glad and etc) code here https://github.com/dalerank/nngui also source work with sdl2/glfw libs
actsl


Joined: 09 Feb 2016
Posts: 83
dalerank wrote:
Hello, i added nanogui fork without dependecies (eigen, glad and etc) code here https://github.com/dalerank/nngui also source work with sdl2/glfw libs

This is a GUI for OpenGL that works together with SDL2, it is not directly for SDL2. I'm sorry, i didn't try it and don't know how well it works. I counted 20525 lines of code, but got an error about nngui_resources.cpp "Sorry about that, but we can’t show files that are this big right now", i understand this is only a C file for resources though. But kiss_sdl is only 2437 lines of code. I think it is more advanced than mine, not sure though whether in every respect, like in the example i see no scrollbars.

I think it is a great work done and great that it is made available for people for free. Please don't understand me wrongly though, but i think it's very important to describe the features well, so that the users know better what the different widget toolkits are. It is said to be "minimalistic" in GitHub, but it is much more complex than mine, so not sure whether or how it is minimalistic. I mean, because the widget toolkits used to be complex, for advanced users it may be not difficult to see what one or another is about, but for beginners who should decide what widget toolkit they would start to use, this may be an impossible task, when the features are not well described.
actsl


Joined: 09 Feb 2016
Posts: 83
I think it would be good if there were a web page somewhere, where the features of all the widget toolkits that can be used with SDL, were well described, so that the users can easily compare.