How to display X window running SDL-based game on custom

Summary

I have created highly customized and inflexible device driver/sprite animation
code to allow custom graphics hardware to do live video blending. I would
like
to instead port the animation portion of my code to a video game library such
as SDL, and run it in an X window; then change my device driver so that it
takes that X window and blits it across to the frame buffer on my custom
graphics hardware (and so blend the non-transparent parts of my X window
over the live video feed).

Alpha blending is crucial; I need to be able to use 32 bit RGBA pixels in
order to properly blend the sprites over the video. Also, I need to
only write the parts of the X window that change each frame to the
custom hardware, which uses an archaic and slow bus.

If anyone has any ideas, or knows of useful websites, newsgroups, technical
papers or email addresses of individuals that have covered such matters
in the past or that might prove helpful, I’d very much appreciate
it if you could please pass them on.

By the way, I have already implemented sound support in my extant code
using SDL, and I really like it. Now I just need to figure out this X
problem to use SDL for everything!

It sounds like you don’t need the X window at all.
What you can do is create an SDL surface, 32-bit RGBA (or ARGB), perform
all your blitting into that, keep track of dirty rectangles, and copy
the changed portions to your special hardware. If you actually want
this displayed in a window to the user, set the video mode to 32-bit
RGBA/ARGB and use the pixels in the surface returned by
SDL_SetVideoMode().

Problem solved! :slight_smile:

You can find more information on SDL at:
http://www.devolution.com/~slouken/SDL/intro/toc.html--
-Sam Lantinga, Lead Programmer, Loki Entertainment Software