This brief tutorial is designed for user that already familiar in using CDX to know and understand the different between the use of the original CDX library and Active CDX.
Basically, most of the function names and their functionality between the two are the same. Some of the different are:
For example if you want to create a surface in original CDX library:
CDXScreen* Splash = new CDXSurface();
In CDXVisual, it would be written like this:
long Splash = CDXVisual.CreateSurface();
There are no different between the two. Both return the address of the new created surface. The different is that the Active CDX can’t return specific pointer, so it just return a long integer which is actually a pointer to the new surface.
For example, these 4 constructors of CDXSurface taken from the original CDX library:
CDXSurface();
CDXSurface(CDXSurface& aSurface);
CDXSurface(CDXScreen *pScreen, int Width, int Height, BYTE memoryType = CDXMEM_VIDTHENSYS);
CDXSurface(CDXScreen *pScreen, const char *szFilename, BYTE memoryType = CDXMEM_VIDTHENSYS);
Would be written in ActiveCDX as:
OLE_HANDLE CreateSurface();
OLE_HANDLE CreateSurface2(OLE_HANDLE surface);
OLE_HANDLE CreateSurface3(long width, long height, short memoryType);
OLE_HANDLE CreateSurface4(LPCTSTR szFilename, short memoryType);
Please note that you can’t use constant CDXMEM_VIDTHENSYS in ActiveCDX since those kind of constants are undefined. Instead you would have to use the number that represent each constant (ex: number 2 for CDXMEM_VIDTHENSYS).
Don’t be confused by the use of many different way in representing address, like OLE_HANDLE, CDXSurface*, and long integer. They basically are just the same pointer. The different occurs because they are being used on the different place. Actually, OLE_HANDLE is a long integer too.
Splash->SetColorKey(5);
In ActiveCDX become:
CDXVisual.SetColorkey(Splash, 5);
Other examples:
void SetDest(int t, int l, int b, int r);
void SetSrc(int t, int l, int b, int r);
void SetColorKey(DWORD col);
void SetColorKey(void);
In ActiveCDX become:
void SetDest(OLE_HANDLE surface, long x1, long y1, long x2, long y2);
void SetSrc(OLE_HANDLE surface, long x1, long y1, long x2, long y2);
void SetColorKey(OLE_HANDLE surface);
void SetColorKey2(OLE_HANDLE surface, OLE_COLOR color);
HRESULT Flip(BOOL VSync=TRUE, BOOL FlipWithStretch=TRUE, BOOL displayFPS = FALSE);
In ActiveCDX become 2 functions:
long Flip();
long Flip2(BOOL bVSync, BOOL bFlipWithStretch, BOOL bDisplayFPS);
The Step by Step Tutorials
In each example, there is a file named "step.htm". This file contains the step by step procedures to make the example. You might find this file to be a great help to start you coding using ActiveCDX. So, make sure you want to check them out. Further question about ActiveCDX can be asked via CDX mailing list.