“Piotr Dubla” wrote
I just wanted to find out something. I assume SDL uses DirectX in windows
and I currently converting a class for playing movies from CDX to SDL. I
need to know if the equivalent functions exsist in SDL
Can I return a DD Surface pointer using SDL and how?
hello piotr. first thing you need to do is unlearn the damage
that directx has done to you. :]
on windows SDL can use one of two graphics backends. one is directx
and the other is a simple (but in some cases, quicker) DIB graphics.
while SDL does have access to the directdraw surfaces deep inside,
they are unavailable to you directly. this is a VERY good thing, since
it ensures your program will work on all platforms and drivers.
(for example windows NT4 which has no directdraw. not to mention
unix, mac, beos, etc)
Anyways, in reference to the code you posted…
#define CDX_LPDIRECTDRAWSURFACE LPDIRECTDRAWSURFACE
#define CDX_LPDIRECTDRAW LPDIRECTDRAW
CDX_LPDIRECTDRAW GetDD(void) { return m_lpDD; }
CDX_LPDIRECTDRAWSURFACE GetDDS( void ) { return m_lpDDS; }
There is no “toplevel” type of object in SDL like you have are
demonstrating here with the LPDIRECTDRAW pointer. You just make
calls to the SDL functions (all prefixed with SDL_). As for the
surface, again like i mentioned you don’t actually use directdraw,
but instead just use an SDL surface (which keeps its own directdraw
surfaces hidden inside). technically that would make your last
function look like this;
SDL_Surface* GetScreen(void) {return m_lpScreen;}
or something to that effect. of course, SDL already has a builtin
function like this, SDL_GetVideoSurface(), so you really don’t
even have to worry about that.
you’ll definitely want to take a look at some of the examples
and demos for SDL and see how it works. basically all the 'management’
that is required for directdraw to run is gone with SDL, just write
your program, not a ton of scaffolding for your program to run in.
good luck with SDL.