SDL for applications?

On the contrary, I used to run Quake all of the time over the network, and
it was actually faster that running locally for me at the time. It doesn’t
work well over 10Mb, but it flies over 100Mb. :slight_smile:

		Cheers, 
			MattOn Fri, Oct 13, 2000 at 09:35:11AM -0700, David wrote:

But yes, running and SDL app over the network is bad
in traditional X style… but then again I wouldn’t think
of running Quake like that :slight_smile:

No, that’s not the only difference. The big difference is that the user
does not have control over those windows through the window manager. On
lower resolution screens (800x600), I run applications like GIMP over
multiple desktops in E. You lose power, flexibility, and speed.

		Cheers,
			MattOn Fri, Oct 13, 2000 at 09:46:57AM -0400, Garrett Banuk wrote:
What about having multiple windows inside of the one SDL window? The

only difference is that you don’t get to see your pretty desktop
background between the windows.

http://www.mongeese.org

Hi everyone,

I’m wondering if there’s a way to “steal” input for an SDL game from
a window other than the one the game is actually being displayed in
(under Linux)?

In the normal case of running SDL under X Windows, when
an SDL game is launced from an xterm, a second X window will open
up and display the game. Of course, it is when this second window has
input focus that mouse and keyboard events will be passed to the game.
But instead, I want to take mouse and keyboard events not from the
window which was created to display the game, but from the xterm from
which the game was launched.

And the reason I want to do this hare-brained thing is…

We have a custom PCI graphics card that displays a frame buffer
on a television screen. I have written a proper SDL driver (down
in src/video/…/ ) for this hardware, so that non-interactive
applications (like MPEG1 playback) appears on the television.
The problem is when the app is interactive and expecting input;
since the SDL driver for our hardware is just writing the frame
buffer, there’s nothing like an X Window created for receiving
input. So, it would be very useful to be able to capture input
from the launching xterm in order to control SDL games
etc. while they are displayed via our custom hardware.

Any ideas?

Steve Madsen

What about having multiple windows inside of the one SDL window? The

only difference is that you don’t get to see your pretty desktop
background between the windows.

There is actually a way to do this and see the desktop in the background
too. I’ve never seen this implemented, but it’s been talked about before.
Check out the GTk demo:
http://www.libsdl.org/projects/gtk-demo/

See ya,
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

We have a custom PCI graphics card that displays a frame buffer
on a television screen. I have written a proper SDL driver (down
in src/video/…/ ) for this hardware, so that non-interactive
applications (like MPEG1 playback) appears on the television.
The problem is when the app is interactive and expecting input;
since the SDL driver for our hardware is just writing the frame
buffer, there’s nothing like an X Window created for receiving
input. So, it would be very useful to be able to capture input
from the launching xterm in order to control SDL games
etc. while they are displayed via our custom hardware.

Any ideas?

If you run this from the console (not an xterm), you should be able
to use the fbcon keyboard/mouse code.

If you run this from X, then your driver should open up a separate
window and use the X11 event code to get input from it and send it
to SDL.

You could theoretically write an input driver that took input from
stdin, but you wouldn’t be able to get mouse events and you would
have to do really crazy translation to convert from “cooked” input
to the raw input which SDL expects.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

QuoteMstr wrote:

SDL is pretty poorly suited for windowed GUIs. The drawing model is
wrong -
it uses the “direct framebuffer” model where you really would like to have
primitives for drawing and window management. SDL is usually a disaster
across a network, way inferior to any GUI toolkit (even Qt).

VNC seems to work well enough, and that works on the pixel level.


“Do not meddle in the affairs of wizards, for they are subtle and
quick to anger.” – J.R.R. Tolkein

VNC updates small patches, which they called “hextiles”.

SDL is pretty poorly suited for windowed GUIs.

On the contrary, it depends on the platform.
Using OpenGL for 2d applications can make for
beautiful, hardware accelerated, windowed GUI’s.

beautiful != fast or useable. And over a network?

Raster, (of enlightenment fame), has hinted that
a future version of E may depend upon OpenGL support
to handle rendering. Then again, Raster does live
in the fantasy land of VA. But I think you might
beable to see where I’m going.

I believe more in what I’ve seen from Keith Packard’s work with a
Render extension, and another for translucent windows in X.

OpenGL draws your polygons = widgets, antialiased text,
etc, and all you have to do is worry about your event
loop, (which you’d have to do if you were writing
raw X without the Gtk or Qt anyways :slight_smile:

You still want a windowing system, a hierarchical rectangle manager,
low-bandwidth event handling, etc. And you would need openGL for that,
and probably accelerated 3d hardware

SDL is usually a disaster
across a network, way inferior to any GUI toolkit (even Qt).
I don’t think this can be changed without bloating SDL.

This is purely a matter of RPC, the SDL needn’t even
know about this. Write a client/server app, install
the SDL on the client machines, and do all the processing
on storage on your cluster of servers in the back room.

that could be used as an argument against X11 as well. Why isn’t
the Windows NT display system network transparent? It’s purely a
matter of RPC… Some people think that the network-transparency
of X11 is a good thing anyway

Matt Busigin wrote:

  But yes, running and SDL app over the network is bad
  in traditional X style... but then again I wouldn't think
  of running Quake like that :)

On the contrary, I used to run Quake all of the time over the network, and
it was actually faster that running locally for me at the time. It doesn’t
work well over 10Mb, but it flies over 100Mb. :slight_smile:

                    Cheers,
                            Matt

Quake, or any other OpenGL app, is not the same thing. GL apps send GLX
requests which are rendered locally. SDL apps push bitmaps over the
wire.> On Fri, Oct 13, 2000 at 09:35:11AM -0700, David wrote:

Mattias Engdeg?rd wrote:

I believe more in what I’ve seen from Keith Packard’s work with a
Render extension, and another for translucent windows in X.

  OpenGL draws your polygons = widgets, antialiased text,
  etc, and all you have to do is worry about your event
  loop, (which you'd have to do if you were writing
  raw X without the Gtk or Qt anyways :)

You still want a windowing system, a hierarchical rectangle manager,
low-bandwidth event handling, etc. And you would need openGL for that,
and probably accelerated 3d hardware

The funny thing is that I asked Keith about this exact thing when I met
him at the NY LWCE. He shot me down rather quickly for suggesting the
idea
of having a full-screen GUI app which uses only one window. Since then
I’ve implemented what I suggested, and now I know exactly what he was
talking about. But it took trying it to teach me. I’m thick that way.

that could be used as an argument against X11 as well. Why isn’t
the Windows NT display system network transparent? It’s purely a
matter of RPC… Some people think that the network-transparency
of X11 is a good thing anyway

At this point, I’d almost give up network transparency if it meant
we got better hardware accel for basic operations. Like alpha
blitting, for example. X is a bit of a dog.

-Ray

At this point, I’d almost give up network transparency if it meant
we got better hardware accel for basic operations. Like alpha
blitting, for example. X is a bit of a dog.

http://www.xfree86.org/~keithp/render/

There’s a limit to network-transparency of course, but the point being that
you don’t need to explicitly concern yourself about the client-server
division or RPC protocol in your code. It just works.

Some people claim that this is just a limitation of our programming model
and with the right transparent RPC system we can have it everywhere.
Microsoft seems to belong to this faction, in their nebulous .NET campaign.
Show me the code. (Or, if you work for Microsoft, please don’t.)

No, the original Quake does not use OpenGL - nor does Quake2. There are GL
versions of both available, but I didn’t use them (I have yet to find a useable
GL application unless you have HW accel, which I don’t have on my notebook).

		Cheers,
			MattOn Fri, Oct 13, 2000 at 07:34:14PM -0400, Ray Kelm wrote:

Quake, or any other OpenGL app, is not the same thing. GL apps send GLX
requests which are rendered locally. SDL apps push bitmaps over the
wire.

well here are my thoughts and wishes on the subject and others:

for a program i have been thinking about writing it would be nice to be able
to have mutiple SDL windows, i would mainly be using the windows for doing
things like displaying video streams and images and would like a
crossplatform way of doing it without having to stick all of it in one big
window.

one other thing that i guess is the same topic is id like to be able to send
video to multiple devices, such as maby send it to 2 seperate framebuffer
devices or instances of X, or cross the 2 and have output of one video device
(say to output to a TV) and also have an SDL window or 2 in X.

another semi off topic thing i would like to know about is using gtk with
SDL, i know it can be done in X but are there any crossplatform ways of doing
it? maby this could be worked into SDL? i would like to be able to make a
GTK/SDL app that has a video(or more than one) being played by SDL in a GTK
window and have it be portable to all platforms that support SDL and GTK
(currently Windows, Unix, and i believe Beos support of GTK is in the works)

Jess

Garrett Banuk wrote:> I was wondering, what do you people think of sdl’s use for applications,

not just games? I was doing some research on emulated guis and SDL seems
like a perfect base for this, yet I havn’t seen much use with SDL in the
application area.

http://www.mongeese.org

well here are my thoughts and wishes on the subject and others:

for a program i have been thinking about writing it would be nice to be able
to have mutiple SDL windows, i would mainly be using the windows for doing
things like displaying video streams and images and would like a
crossplatform way of doing it without having to stick all of it in one big
window.

one other thing that i guess is the same topic is id like to be able to send
video to multiple devices, such as maby send it to 2 seperate framebuffer
devices or instances of X, or cross the 2 and have output of one video device
(say to output to a TV) and also have an SDL window or 2 in X.

another semi off topic thing i would like to know about is using gtk with
SDL, i know it can be done in X but are there any crossplatform ways of doing
it? maby this could be worked into SDL? i would like to be able to make a
GTK/SDL app that has a video(or more than one) being played by SDL in a GTK
window and have it be portable to all platforms that support SDL and GTK
(currently Windows, Unix, and i believe Beos support of GTK is in the works)

Jess

Garrett Banuk wrote:> I was wondering, what do you people think of sdl’s use for applications,

not just games? I was doing some research on emulated guis and SDL seems
like a perfect base for this, yet I havn’t seen much use with SDL in the
application area.

http://www.mongeese.org

another semi off topic thing i would like to know about is using gtk with
SDL, i know it can be done in X but are there any crossplatform ways of doing
it? maby this could be worked into SDL? i would like to be able to make a
GTK/SDL app that has a video(or more than one) being played by SDL in a GTK
window and have it be portable to all platforms that support SDL and GTK
(currently Windows, Unix, and i believe Beos support of GTK is in the works)

Actually, I am making a SDL app like that, integrating SDL over a
GtkDrawingArea, with full screen support, ticks, and things like that.
My main target is the demoscene, but I think it can be used for things
like an opengl enviroment or a 2D video application… everything is
possible. But there are many problems I have, like events management.
The project is in a very early stage (specially because I am learning
gtk and SDL at the same time), but as soon as I have something to work
on it, it will be released.–
signed
derethor of centolos

Actually, I am making a SDL app like that, integrating SDL over a
GtkDrawingArea, with full screen support, ticks, and things like that.
My main target is the demoscene, but I think it can be used for things
like an opengl enviroment or a 2D video application… everything is
possible. But there are many problems I have, like events management.
The project is in a very early stage (specially because I am learning
gtk and SDL at the same time), but as soon as I have something to work
on it, it will be released.

When SDL is passed a separate window id, it assumes that you are going
to be doing event handling with whatever mechanism you used to create
the window.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Sam Lantinga wrote:

When SDL is passed a separate window id, it assumes that you are going
to be doing event handling with whatever mechanism you used to create
the window.

I didnt understand very well the system that SDL uses to give that
window id. The “hack” is to use the env variable (SDL_XWINDOWID or
something similar)… but may you explain a little bit this? how does
this process work? who reads that env. variable?–
signed
derethor of centolos

JessH at lbjhs.net wrote:

another semi off topic thing i would like to know about is using gtk with
SDL, i know it can be done in X but are there any crossplatform ways of doing
it? maby this could be worked into SDL? i would like to be able to make a
GTK/SDL app that has a video(or more than one) being played by SDL in a GTK
window and have it be portable to all platforms that support SDL and GTK
(currently Windows, Unix, and i believe Beos support of GTK is in the works)

SDL isn’t well suited for applications. You would be better off using a
cross-platform application framework like wxWindows (www.wxwindows.org), which
uses GTK for its Linux version. Also I am working on writting a wxWindows
control for displaying SDL applications. Which since wxWindows uses GTK, that
would very indirectly be having SDL in GTK. Since people seem obsessed with
mixing SDL and GTK, I will tell the mailing list when I have finished it.

- David Snopek

Sam Lantinga wrote:

When SDL is passed a separate window id, it assumes that you are going
to be doing event handling with whatever mechanism you used to create
the window.

I didnt understand very well the system that SDL uses to give that
window id. The “hack” is to use the env variable (SDL_XWINDOWID or
something similar)… but may you explain a little bit this? how does
this process work? who reads that env. variable?–
signed
derethor of centolos

for a program i have been thinking about writing it would be nice to be able
to have mutiple SDL windows, i would mainly be using the windows for doing
things like displaying video streams and images and would like a
crossplatform way of doing it without having to stick all of it in one big
window.

Probably the best solution for this would be to integrate SDL and a
cross-platform windowing toolkit. SDL never was intended to interact
as a set of multiple windows in a windowing environment.

one other thing that i guess is the same topic is id like to be able to send
video to multiple devices, such as maby send it to 2 seperate framebuffer
devices or instances of X, or cross the 2 and have output of one video device
(say to output to a TV) and also have an SDL window or 2 in X.

Definitely. This is in the plans for SDL 2.0.

another semi off topic thing i would like to know about is using gtk with
SDL, i know it can be done in X but are there any crossplatform ways of doing
it? maby this could be worked into SDL? i would like to be able to make a
GTK/SDL app that has a video(or more than one) being played by SDL in a GTK
window and have it be portable to all platforms that support SDL and GTK
(currently Windows, Unix, and i believe Beos support of GTK is in the works)

The SMPEG GTk graphical player, gtv, works great on both Linux and Windows.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Sam Lantinga wrote:

When SDL is passed a separate window id, it assumes that you are going
to be doing event handling with whatever mechanism you used to create
the window.

I didnt understand very well the system that SDL uses to give that
window id. The “hack” is to use the env variable (SDL_XWINDOWID or
something similar)… but may you explain a little bit this? how does
this process work? who reads that env. variable?

Take a look at the GTk demo for an example:
http://www.libsdl.org/projects/gtk-demo/

Basically, you set the environment variable in your application, before
SDL_Init(), and SDL interprets it internally. Interestingly enough, you
can set the environment variable from a script before calling an SDL app,
to get video output to an arbitrary window. Be careful though! SDL doesn’t
accept input from the window. :slight_smile:

See ya,
-Sam Lantinga, Lead Programmer, Loki Entertainment Software