Archived

This topic is now archived and is closed to further replies.

s_cloudx

Mirrored Sprite

Recommended Posts

Guest Anonymous Poster   
Guest Anonymous Poster
if you''re using direct3d then alter the texture coords.
eg. if you have a quad with vertices with texture coords like so:
vert1 (0,0) vert2 (1,0) vert3 (1,1) vert4 (0,1) then change these texture coords to:
vert1 (1,0) vert2 (0,0) vert3 (0,1) vert4 (1,1)
In DirectDraw I''m not so sure, you may have to mirror the sprite graphics in a graphic editor.

Share this post


Link to post
Share on other sites
Sharky    197
If you are using DirectDraw then take a look at the DDBLTFX structure (which you can use with the DirectDraw Blt function). This allows you to mirror left-to-right and/or top-to-bottom. This may be what you are looking for. Most modern graphics hardware will do these blits using the hardware itself, but some of the older graphics cards revert to slower software methods when it comes to mirroring sprites... in this case it would be better to either pre-mirror your sprites or simply provide multiple mirrored sprites using your favourite art package.

Cheers,
Sharky

Share this post


Link to post
Share on other sites
Sharky    197

I haven''t done this for a while but I believe it is something along these lines...

  
// source and destination rectangles

RECT srcRect;
RECT destRect;

// ptr to the [src and dest] directdraw surfaces

LPDIRECTDRAWSURFACE lpSurfSrc;
LPDIRECTDRAWSURFACE lpSurfSprite;

// the effects structure (for mirroring)

DDBLTFX ddBltFx;

// set up the DDBLTFX structure in your code

ddBltFx.dwSize = sizeof(DDBLTFX);
ddBltFx.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT;

// you would call your blit routine along the lines of...

lpSurfDest->Blt(&destRect,lpSurfSprite,&srcRect,DDBLT_DDFX,&ddBltFx);



Remember to set the relevant values in the RECT structures and set your parameters accordingly. The DDBLT_DDFX flag tells the blit to use the DDBLTFX structure, which tells the blit to perform the sprite mirror operation (DDBLTFX_MIRRORLEFTRIGHT).

I think this is more or less how it works, although you may have to read up on this as I have no reference material to hand...

Good luck,
Sharky

Share this post


Link to post
Share on other sites