Wouldn’t this make your code non-portable? “MessageBox()” is a Windows
function…
- Just becasue I’m using SDL does not mean I want my code to be portable,
right ? (probably will at some stage)
Actually, we’re using MessageBox() as well and our code is quite portable.
We just don’t use it elsewhere. And last time I looked, that particular
thing was broken because SDL_Quit seems to kill off the program before the
message box is displayed with the reason why for most people. Not had a
chance to really try this out yet. May feed the DynGL code something
really broken to test it.
- The thing I’m using MessageBox for right now is just for getting some
debug information for myself when the code is done.
That’s quite fine, just mark it with a FIXME comment so you can search for
it later easily. You don’t have to listen to me of course, but it’s
basically a good idea.
- Is there a generic way to show a window with some text ? A portable way
!!
'fraid not. Here’s the best I can do:
void
System_Error (char *error, …)
{
va_list argptr;
char text[4096];
va_start (argptr, error);
vsnprintf (text, sizeof (text), error, argptr);
va_end (argptr);
// Shut down the system if we can
System_Shutdown ();
#ifdef HAVE_FCNTL
// change stdin to non blocking
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY);
#endif
#ifdef _WIN32
// Win32 gets a GUI message box
MessageBox (NULL, text, “Error”, 0);
#else
fprintf (stderr, “Error: %s\n”, text);
#endif
// This function does nothing unless you have execinfo.h
System_BackTrace (2);
// Should already have been called
SDL_Quit ();
// That's about all we can do...
exit (1);
}
This is sufficient for our purposes since we currently only support Win32,
Linux, and MacOS X. I am willing to work on a more generic messagebox
function that supports more platforms and add it to the pile of useful
things for SDL programmers page I’ve started working on. URL when there
is a good bit of content there - I haven’t even got a working gen 3 DynGL
written for the page yet. =(On Tue, May 14, 2002 at 08:45:44AM +0200, Sam Nova wrote:
–
Joseph Carter My opinions are always right
I invoke Espy’s law, which states that you all suck
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020514/46215171/attachment.pgp