Was looking for a cross-platform open file dialog for SDL that I could use to select files if one isn't provided via command line. There are lots of options but finding a solution isn't as easy as I would like.

There are SDL programs like Bard and Milkytracker that have this sort of functionality. The code for the file dialog functionality is integrated with the programs, so it would be hard to remove it and use it as a library for other programs.

One could integrate SDL with other GUI toolkits. There are some interesting articles on how to do just that. However, I'd like to avoid the overhead of the heavier toolkits.

Nuklear has a file browser example. The basic Nuklear backend uses OpenGL instead of SDL. One would need SDL_gpu or a similar solution to use Nuklear with a SDL backend.

otk has a file browser example ( http://otk.sourceforge.net/tutorials.html ). It also uses OpenGL instead of SDL, but it needs less dependencies than Nuklear to build. It's worth considering, but it's not quite as ergonomic as other options.

The dialog program which can be built with ncurses, pdcurses or other versions of curses has a directory selection dialog. Applications built with pdcurses can use a SDL backend. However, that would mean adding a pdcurses dependency to projects. Plus, dialog is a program and it's not really designed to be called as a library. There are other options that will build with pdcurses and are designed to be called as a library such as CDK.

A similar option to the dialog solution would be to use BSD libform and pdcurses. One would need to write the rest of the dialog functionality though.

Some small projects use tiny file dialogs ( https://sourceforge.net/projects/tinyfiledialogs/ ). It can use native Windows or conio options on Windows. However, on Linux systems it would need some help from tools like dialog or zenity or similar tools.

When searching for SDL file browsers, I ran across this code:
https://www.omnimaga.org/ti-nspire-projects/sdl-file-browser/
It has a GNU GPL 3 license. It's written for SDL 1.2.

There's also the Jlime project's fileselector code. It works well enough and it's fairly readable. It has a GNU GPL 2 license. It's written for SDL 1.2. So, a port for SDL 2.x would be needed. Plus, I needed to add some support on Windows to use the GetCurrentDirectory in place of getcwd in order to build it successfully.

Those are the options I've found so far. I'd love to track down some other possibilities. Have any other SDL based suggestions? Please share them.
Links to dialog and dialog-like utilities for use mainly with scripting or possibly creating simple GUIs with C programs are covered below. Dialog utilities are typically used on POSIX systems. There are some notes on portability to Windows platforms.

URLs are accurate as of when this was posted. However, they can change over time. You can use a search engine or archive.org wayback tool to find pages that have been moved or backups of older versions of pages.

Dialog
https://web.archive.org/web/20130602021132/http://www.openwatcom.org/index.php/Dialog_howto
How To for building Dialog on OpenWatcom. It builds on MinGW with msys just as well. However, a few of the lines in the OpenWatcom patches for handling directory structures differently aren't needed. Dialog provides console GUI interaction for batch and shell scripts.

I have a newer set of patches for dialog that adds more feature support on Windows. If there's interest, I can upload the source code as part of my LM BLD project at some point: http://www.distasis.com/cpp/lmbld.htm

LM BLD ui patches
http://www.distasis.com/cpp/lmbld.htm#lmbldui
Patches to cross-platform portable browsers so that they can be used as user interfaces. Offers the ability to create user interfaces with basic HTML and CSS. Can work with UTF-8 files to support internationalization. I personally prefer this method to scripting with dialog. HTML and CSS are standardized and there's more control over the look and feel of dialogs.

Gui It !
http://www.lprp.fr/soft/misc/guiit/guiit_en.php3?lid=320
WxWidgets based front ends using simple XML configuration files.

yad
https://sourceforge.net/projects/yad-dialog/
Yet another dialog, this is a fork of zenity with many added features. Uses GTK+ 2 to offer Windows look and feel for user interface objects and offers cross-platform use. Support for MinGW has been added to the source code. GTK+ 3 port available.

zenity
http://www.placella.com/software/zenity/
This provides a simple GUI interface for batch and shell scripts. It's been ported from POSIX systems to work with MinGW, msys and GTK+ 2. Similar to Dialog, but possibly less functions. Latest version of zenity supports GTK+ 3.

gxmessage
http://crash.ihug.co.nz/~trmusson/programs.html
Builds with MinGW and msys if GTK libraries (2 or 3) are installed. Similar to Dialog but slightly different functionality.

Xdialog
http://xdialog.free.fr/
Builds with MinGW and msys if GTK libraries are installed. Dialog port using GTK instead of pdcurses. Used following configure options: ./configure --with-gtk2 --with-scanf-calls.

gtkdialog
https://web.archive.org/web/20120303170146/http://linux.pte.hu/~pipas/gtkdialog
http://puppylinux.org/wikka/gtkdialog
Has much more functionality than Dialog or Zenity. Compiles and builds fine with MinGW and msys. However, when run to produce a dialog through a script, it hangs, presumably due to threading issues on Windows. Tried adding -mwindows -mthreads to CFLAGS and -lpthread to the libraries, but worked the same.

lxdialog
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/scripts/kconfig/lxdialog?id=HEAD
Haven't tried porting this to Windows. It provides a dialog like interface for Linux kernel configuration.

libdialog
http://ftp.tw.freebsd.org/pub/FreeBSD-stable/src/gnu/lib/libdialog/
FreeBSD dialog library for use with C programs.

April 2025

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
27282930   

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 26th, 2025 01:13 am
Powered by Dreamwidth Studios