Jump to content
  • Advertisement

Archived

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

Guest Anonymous Poster

2d Engine

This topic is 6920 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Using DirectDraw it is :

code:

DDBLTFX ddbltfx;
ZeroMemory( &ddbltfx, sizeof(ddbltfx) );
ddbltfx.dwSize = sizeof(ddbltfx);
ddbltfx.dwFillColor = RGB(0,0,0);
lpDDSBack->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);

CU

------------------
Skullpture Entertainment
#40842461

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Yes I'm using DD.

So will memcpy work?

Share this post


Link to post
Share on other sites
Use the above code -- its faster then memset would be because it can be hardware accelerated.

--TheGoop

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
OK, thats working..Thanks everyone.

Next prob.

Scrolling. If I put a screen up thats say 640x480. Now I want to scroll infinte, whats the code for that. I know the idea how it works, but unsure of where to start.

It's like, move the screen down by say 3 lines. Those 3 lines print at the top..yes?

If so, how do I actually read the lines in and out?

Thankyou

Share this post


Link to post
Share on other sites
The old wrap around technique when blitting in DOS (using memcpy) does not work in DirectDraw, instead, you have to blit the main area, then do two more blits to fill in the empty spaces above and to the side of the main blit, then you need to blit a forth surface to fill in the empty corner.

Also, make sure you clip the blits to the screen correctly, or your system may hang or get VERY slow, causing alot of INVALID_PARAM errors when using ->bltfast().

How ive done it..
I have made my own function called BlitFastClip() which automatically clips the blit to the screen no matter what co-ordinates I throw at it. This is very useful, as it eliminates excess calculations when bliting backgrounds and sprites.

Check out the FoxBear sample code in your DX3SDK package. It has the code to scroll backgrounds horizontally. All you have to do is modify the code so it will scroll vertical as well.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hi Everyone,

I'm making a 2d engine and come across my first problem. I want to clear the screen, how?

I'm trying to use as many fast commands as possible. I thought of using memcpy but I think it doesn't work, my computer just hangs.

In DOS I did "memcpy(VGA,0,64000);"
Is there a Windows version?

Thanks

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!