Dialog/Message boxes with SDL? [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this questionIs there any library I can use in conjunction with SDL to present alerts to the user? Currently i'm writing my output to stdout, but would prefer to interact with the user via an interface of sum sort!
There are several GUI libraries listed in the libraries section of the SDL site.
For what is worth, I looked at all those libs and decided none fit my needs. I'm writing my own.
Not really, as far as I know you pretty much have to: 1) write your own using graphics primitives or 2) write OS specific code for each target platform to open a dialog window.
For the first option, you haven't mentioned if you are using SDL for 2D graphics or with OpenGL? If you are using OpenGL I believe there are GUI libraries available that use OpenGL primitives to create GUI elements, I'd try searching for "OpenGL GUI". If you lookup how to render fonts with SDL_ttf and get that going you could write text responses to the display using that.
The second option requires you to research how to open a message box on each platform you want to target and use #ifdefs to control which one is used. For example if you want to target windows, OS X and Linux you'll need to write 3 dialogue box functions, using the windows api, Cocoa and X11.
I am the author of tiny file dialogs on sourceforge. It is a single C file with just five function calls including message box and question dialog. It has no main loop and complement SDL easily.
精彩评论