SFML community forums

General => Feature requests => Topic started by: Mark on December 12, 2013, 06:40:00 pm

Title: Message Boxes
Post by: Mark on December 12, 2013, 06:40:00 pm
Hello guys  :)
Have you ever wondered how to easily (one line of simple code) and elegantly (a nice, tiny message box with OK button and icon (windows default ones available: error, warning, info, question)) inform the user (or yourself) about an error or something else? You won't need to use enormous gloomy console/terminal or learn a way yourself how to create a portable alternative anymore! Wouldn't that be great? I know it was suggested back in 2009 but maybe 4 years have changed some minds. And hey hey hey, SDL 2.0 had introduced this function SDL_ShowSimpleMessageBox (http://wiki.libsdl.org/SDL_ShowSimpleMessageBox (http://wiki.libsdl.org/SDL_ShowSimpleMessageBox)), so I see a demand! What do you think about it? Well, it was very useful for me to show that program couldn't find files or the levels had corrupt data and so on... I mean, they were really, really useful for me, and I think so they would for others  ;)
Title: AW: Message Boxes
Post by: eXpl0it3r on December 12, 2013, 06:52:42 pm
I don't think it would fit into SFML's scope, regardless what other similar libraries do. SFML is a multimedia library, thus shouldn't provide all kinds of system functions.
Title: Re: Message Boxes
Post by: Tank on December 13, 2013, 08:25:54 am
Quote
Well, it was very useful for me to show that program couldn't find files or the levels had corrupt data and so on... I mean, they were really, really useful for me, and I think so they would for others
Useful for sure, but too specific for the library. What about using std::cerr for reporting errors during development? I always found message boxes to be annoying for outputting debug information.
Title: Re: Message Boxes
Post by: DashWave on December 13, 2013, 06:43:14 pm
I support the idea of adding a MessageBox function to SFML. Sure, they suck for debugging, but they are very useful for errors that should be reported to a user. For example, when you need to tell a user that a font failed to load.

Currently, one has to do:
#ifdef _WIN32
#include <windows.h>
#endif

...

#ifdef _WIN32
MessageBox(NULL, "text", "caption", MB_OK);
#endif
 

And you'd also obviously have to account for OSes other than Windows.

SFML might be a multimedia library but keep in mind there is a system module that basically consists of useful things that are painful to do in a cross-platform way. sf::Clock and sf::Thread don't exactly have much to do with multimedia.
Title: Re: Message Boxes
Post by: Nexus on December 13, 2013, 06:55:22 pm
There was a recent discussions about message boxes in this thread (http://en.sfml-dev.org/forums/index.php?topic=13464.0).

To sum up, the argument was: When an application fails to load crucial resources, message boxes may be the only way to notify the user. It's not possible to output text in the window without a font, and especially on Windows there is often no console. The current alternative is a log file entry.
Title: AW: Re: Message Boxes
Post by: eXpl0it3r on December 13, 2013, 08:18:09 pm
SFML might be a multimedia library but keep in mind there is a system module that basically consists of useful things that are painful to do in a cross-platform way. sf::Clock and sf::Thread don't exactly have much to do with multimedia.
All the things you find in the system module exist because they get used by SFML internally.
The clock is a crucial one might even say the most important functionality for about anything multimedia.
The threads are usef to play sound in parallel, once SFML goes C++11, they'll most likely vanish.
Vectors get used all over the place.
etc

I guess it wouldn't be too bad to have that kind of feature, it still doesn't seem to fully fit SFML. ;)
Title: Re: Message Boxes
Post by: eigenbom on December 15, 2013, 01:14:25 am
I agree that this would be handy. If there's a serious issue (bad video card, can't load resources, ...) then a message box is the simplest way to relate that to the user.