Skip to main content
gamedev.net
🔒 Locked

blitting sprites

Started by x-e-cuter 2 replies 250+ views
Original Post
x-e-cuter
x-e-cuter
hi can anyone help? I''m using directX to make a simple platform game and I have some bitmaps of the character I will use. I have about 10 bitmaps to animate him. The only problem is that he is facing right in the bitmap and I don''t know how to blit it so hes facing the other way. I know I could have 10 more bitmaps with him facing left but that doesn''t seen efficient. can you help? also it you could tell me how I can rotate the sprite as well as reflect it that would be great many thanks andy
x-e-cuter
x-e-cuter
I''ve tried something using DDBLTFX but it won''t work, heres my code...what am I doing wrong

if (Transparency) t = DDBLT_KEYSRC;

DDBLTFX dd;

dd.dwSize = sizeof(dd);

dd.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT;

Surface -> Blt(&BitmapRect, Bitmap, NULL, DDBLT_WAIT | t, ⅆ);

thanx
Cahaan
Cahaan
Ok here we go:

DDBLTFX ddbltfx;
ZeroMemory(&ddbltfx, sizeof(ddbltfx)); //don't forget this line
ddbltfx.dwSize = sizeof(ddbltfx);
ddbltfx.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT;

Then, you blit like that:

Surface -> Blt(&BitmapRect, Bitmap, NULL, DDBLT_WAIT |DDBLTFX, &ddbltfx);

If it doesn't invert your sprite, that's simple: Your graphic card doesn't support it, and you have to emulate DirectDraw with your CPU (which is a GOOD thing for DirectDraw anyway).

So the solution is to put an emulation flag when you create your ddraw interface with DirectDrawCreateEx. It will be quicker and everything will work better actually.

[edited by - Cahaan on August 6, 2002 8:14:51 PM]
Darkhaven Beta-test stage coming soon.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.