xuni: a Graphical User Interface Widget Toolkit
I've finally uploaded a reasonably recent version of xuni, my latest project. It's a GUI (Graphical User Interface) "library" (Widget Toolkit) for the SDL, written in C. (I hope to make it a library eventually, but right now it's just a program . . . .)
Here it is: http://dwks.theprogrammingsite.com/m...wn/xuni.tar.gz
Here's a screenshot (subject to change): http://dwks.theprogrammingsite.com/m...n/xunishot.jpg
This is a very preliminary upload. It's the subversion version 73. There is no Windows executable, though there are 32-bit and 64-bit Linux executables. It's not even the absolute latest version, just the latest commit. Anyway, it should run under any platform, assuming you felt like downloading SDL, SDL_image, SDL_ttf, and SDL_gfx in order to compile it. ;) I'll probably have a Win32 executable uploaded pretty soon. Meantime, Windows users can admire my screenshot. :) It doesn't do the parallax justice.
Textboxes and listboxes don't work very well, but buttons and (I think) checkboxes do. (Actually, checkboxes work in the latest version, but not this one. Too bad. You'll have to wait for the upgrade. :p ) You can press ALT-ENTER to toggle fullscreen, ALT-F9 to minimize the window, and different keys instead of clicking on buttons. For example, 'q' quits, at the main menu. I'm in the middle of dealing with themes, so there's lots of code that looks like it's doing things in a stupid way at the moment.
Other than that, xuni is pretty neat. It supports arbitrary screen modes, rescaling widgets and images and text to fit the new size. Its GUI data is in XML files (read via expat), so you can change the positions of the buttons etc without recompiling the program. (Have fun . . . positions are specified as percentages of the screen, i.e. 50 is halfway across the screen.) It has a really primitive "garbage collector", which is really just a reference counter. But at least it does catch some memory leaks, which you'll see if you run the program from the command line. xuni has a very simple expression parser, so you can even use 100/3 instead of 33.3333... in the XML resource files.
It's about 7,000 lines long, which is pretty large for one of my projects. Most of the code is well separated into different source files -- except for graphics.c! -- and nearly all of it is quite well modularized. (I didn't write resize.c, which is SDL_Resize; and it's actually not even used in this version.)
Anyway, have a look at xuni if you feel like it and tell me what you think. Feedback would be much appreciated . . . .
For example: is struct widget_t in graphics.h too unwieldy? Would a void* pointer be better? etc. . . .
I know I put my codeform thread in General Discussions, but I figured that this is a better place for this type of thread. Hopefully it will get some traffic in this forgotten corner of CBoard . . . .