Cross Platform Question

I’m new to the list (just joined) so I appologize if this is a question
that has been asked many times already. I checked the archives and I
haven’t found it, yet…

Is there a good library out there already for doing simple pop up message
boxes. Similar to what you get in windows? I’m working on a project that
could really benefit from a cross platform, lightweight message box. I
don’t need much gui-wise. It’s just that right now, you have to compile
it in windows to get the message boxes to pop up. I’d really like to
change that, and do it in a way that I can remove the last 3 #ifdef’s from
the source :slight_smile:

And I appologize again if this has already been beat to death. Just point
me in the direction of the information and I’ll go read it, and stop
bugging everyone :slight_smile:

I might have to write my own considering how very little functionality I
really want, but I was just hoping someone already knew of a small (this
is important) library that provides attractive (this is also important,
but not quite as much as small) messages boxes on all the sdl platforms.

Thanks,
Jason

[…]

Is there a good library out there already for doing simple pop up
message boxes. Similar to what you get in windows?

Not that I know off, but I sure could use one as well. In fact, I’d also
want a primitive console like the one Quake III: Arena and many other
games pop up when there’s no normal console available.

It has been discussed at least once before, but I don’t remember any
library showing up.

Sure, a message box it’s very trivial to code on most platforms, but just
as an example, I don’t even know the name of the function to use on Mac
OS… And I don’t know what kind of standard message boxes are available
on all platform.

How about just hacking a library up (or just a header and a source file),
so people can start using it, filling in the implementations for their
platforms? I’m going to hack and use something like it sooner or later
anyway, so I might as well maintain it, if no one else cares to do it.

First, we’ll need to come up with an API that will work for all targets,
one way or another.

For example, Win32 has a call that lets you provide a text message, a
standard icon ID, and a code specifying what buttons you want (OK, OK +
CANCEL, YES + NO etc). Is it safe to assume that most platforms can do
something similar, without custom GUI programming? If so, we could use
something like

/* SDLG for SDL (or Simple) DIaLogs */

typedef enum SDLG_Result
{
	SDLG_OK,
	SDLG_CANCEL,
	SDLG_YES,
	SDLG_NO,
	SDLG_CONTINUE,
	SDLG_ABORT,
	SDLG_IGNORE,
} SDLG_Result;

typedef enum SDLG_Style
{
	SDLG_OKBOX,
	SDLG_OKCANCELBOX,
	SDLG_YESNOBOX,
	SDLG_CONTABORTIGN,
} SDLG_Style;

SDLG_Result SDLG_MessageBox(const char *msg, SDLG_Style style);

Comments? Code?

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Wednesday 05 December 2001 23:35, Jason Dagit wrote:

Sure, a message box it’s very trivial to code on most platforms, but just
as an example, I don’t even know the name of the function to use on Mac
OS… And I don’t know what kind of standard message boxes are available
on all platform.

Yes, this is a problem, actually I’ve written a simply message box for my
game, but I’ve yet to use an OS dependant file browser to load/save teams
and games. Actually the file browser is the only os dependant part of my game!

How about just hacking a library up (or just a header and a source file),
so people can start using it, filling in the implementations for their
platforms? I’m going to hack and use something like it sooner or later
anyway, so I might as well maintain it, if no one else cares to do it.

Yes, it would be very useful. I’ll write the AmigaOS dipendant part and if
needed a GTK part :slight_smile:

    SDLG_Result SDLG_MessageBox(const char *msg, SDLG_Style style);

Add also something like:

#define SDLGFB_CANCEL 1
#define SDLGFB_OK 2

SDLFB_Result SDLG_FileBrowser(const char *title, SDL_Browser **datas,
unsigned long Flags)

typedef struct _SDL_Browser { // allocated by SDLG_FileBrowser
char Filename[120];
char Directory[120];
struct _SDL_Browser *NextSelection; // == NULL if single selection
} SDL_Browser;

SDLG_FreeBrowser(SDL_Browser *data); // free all the stuff allocated

Bye,
Gabry (gabrielegreco at tin.it)

[…]

How about just hacking a library up (or just a header and a source
file), so people can start using it, filling in the implementations
for their platforms? I’m going to hack and use something like it
sooner or later anyway, so I might as well maintain it, if no one
else cares to do it.

Yes, it would be very useful. I’ll write the AmigaOS dipendant part and
if needed a GTK part :slight_smile:

Good! :slight_smile:

Add also something like:

SDLFB_Result SDLG_FileBrowser(const char *title, SDL_Browser **datas,
unsigned long Flags)

Yeah, that would be handy…

One thing I’m worried about though, is fullscreen mode. On many
platforms, it’s not possible to pop up a system dialog on top of a
fullscreen mode display. Sure, it would be relatively easy to implement
custom dialogs for the messagebox, but it starts to get messy with the
file selector… heh

Note that the main reason why I’d like message boxes and a console is
that those can be used even if the SDL display should fail to open. In
that respect, it’s not too different from the stdout and stderr
management already done by the core SDL library.

I’m not so sure where the file selector fits in, from this perspective,
as it’s more of a runtime things than an init/exit thing… (Well, at
least as long as it’s always a native system dialog.)

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Thursday 06 December 2001 18:22, Gabriele Greco wrote:

— David Olofson <david.olofson at reologica.se> wrote:

[…]

Is there a good library out there already for doing simple pop up
message boxes. Similar to what you get in windows?

Not that I know off, but I sure could use one as well. In fact, I’d also

want a primitive console like the one Quake III: Arena and many other
games pop up when there’s no normal console available.

It has been discussed at least once before, but I don’t remember any
library showing up.

Sure, a message box it’s very trivial to code on most platforms, but
just
as an example, I don’t even know the name of the function to use on Mac
OS… And I don’t know what kind of standard message boxes are available

on all platform.

How about just hacking a library up (or just a header and a source
file),
so people can start using it, filling in the implementations for their
platforms? I’m going to hack and use something like it sooner or later
anyway, so I might as well maintain it, if no one else cares to do it.

First, we’ll need to come up with an API that will work for all targets,

one way or another.

For example, Win32 has a call that lets you provide a text message, a
standard icon ID, and a code specifying what buttons you want (OK, OK +
CANCEL, YES + NO etc). Is it safe to assume that most platforms can do
something similar, without custom GUI programming? If so, we could use
something like

/* SDLG for SDL (or Simple) DIaLogs */

typedef enum SDLG_Result
{
SDLG_OK,
SDLG_CANCEL,
SDLG_YES,
SDLG_NO,
SDLG_CONTINUE,
SDLG_ABORT,
SDLG_IGNORE,
} SDLG_Result;

typedef enum SDLG_Style
{
SDLG_OKBOX,
SDLG_OKCANCELBOX,
SDLG_YESNOBOX,
SDLG_CONTABORTIGN,
} SDLG_Style;

SDLG_Result SDLG_MessageBox(const char *msg, SDLG_Style style);

Comments? Code?

Why tie this to SDL at all? I don’t think it would be necessary and
considering the potential usefulness of such a library, I think many
programmers would like to be able to use such a library without using SDL.
I can’t think of any specific situation which supports the seperation of
the GUI library and SDL, but I think it would be best for them to be
seperate.> On Wednesday 05 December 2001 23:35, Jason Dagit wrote:

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -’


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

=====
Dave Brondsema
dave at brondsema.net
http://www.brondsema.net


Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

[…system dialogs for SDL programs…]

Why tie this to SDL at all?

Actually, that’s not a requirement - it might just be nice to rely on
SDL for some details.

I don’t think it would be necessary and
considering the potential usefulness of such a library, I think many
programmers would like to be able to use such a library without using
SDL. I can’t think of any specific situation which supports the
seperation of the GUI library and SDL, but I think it would be best for
them to be seperate.

Yeah, you’re basically right, of course. It could be a nice tool for
any applications that need to reach only slightly beyond the scope of
their primary API, and the stdio stuff.

However, there’s one major problem with using a totally SDL unaware
library of this kind with SDL: Fullscreen modes.

First, on many targets, it’s impossible to make a native system dialog
pop up on top of a fullscreen display. Second, it may not even be
possible for the user to swith back to the desktop to see the dialog
without the application explicitly handling the keystrokes involved!

Handling it in a totally safe way would probably require custom
versions of the dialogs, rendering on top of the current SDL screen -
probably too much work to make sense. (At least for file selectors and
the like…)

What might be realistic, though, would be just making the library aware
of SDL’s existence and the problems with fullscreen mode, may help a
great deal. Of course, this could be optional, so that the lib would
still work without SDL if desired.

BTW, speaking of fullscreen issues, does anyone know of a way to detect
system dialogs indirectly caused by your application under Win32? (Would
be very handy to avoid this dreaded problem that for example Q3A is
having if the stupid dial-up connection dialog should pop up while in
fullscreen mode…)

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Friday 07 December 2001 04:20, Dave Brondsema wrote:

If you want a GUI on top of SDL:

http://www.libsdl.org/projects/GUIlib/index.html
http://libufo.sourceforge.net/
http://libuta.sourceforge.net/
http://www.tutok.sk/fastgl/
http://www.bms-austria.com/projects/paragui/
http://www.newimage.com/~rhk/SDL_gui/

If you want a Quake console on top of SDL:
http://www.mongeese.org/SDL_Console/

(These were found after a quick scan of http://www.libsdl.org/libraries.html,
which EVERYONE should read. Not only are there lots of cool projects
there, but also because it will prevent you from reinventing a wheel or
two.)

Don’t ask for these to be put into SDL, since there’s a million options
for you to use already. Don’t assume that there is an API on a given
platform for popping up an external message box, because there’s lots of
embedded platforms that can’t, not to mention svgalib, fbcon, directfb,
fullscreen X11/directx/windib.

–ryan.

Ryan C. Gordon wrote:

If you want a GUI on top of SDL:

http://www.libsdl.org/projects/GUIlib/index.html
http://libufo.sourceforge.net/
http://libuta.sourceforge.net/
http://www.tutok.sk/fastgl/
http://www.bms-austria.com/projects/paragui/
http://www.newimage.com/~rhk/SDL_gui/

How is it that I always get over looked?!?! Ya’ know libksd has a gui??
Here is my shameless project plugin: http://libksd.sourceforge.net/
– David Snopek

/-- libksd –
| The C++ Cross-Platform Game Framework
| Only want to write it once??
| http://libksd.sourceforge.net
------------