Jump to content

  • Log In with Google      Sign In   
  • Create Account

2d Engine


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 10 October 1999 - 07:55 PM

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


Sponsor:

#2 Kentamanos   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 October 1999 - 09:25 AM

Are you using DirectX (DirectDraw in particular)?

------------------

-Kentamanos


#3 NuFAN   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 October 1999 - 11:48 AM

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


#4 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 09 October 1999 - 12:39 AM

Yes I'm using DD.

So will memcpy work?


#5 Facehat   Members   -  Reputation: 696

Like
Likes
Like

Posted 09 October 1999 - 04:49 AM

Use the above code -- its faster then memset would be because it can be hardware accelerated.

--TheGoop


#6 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 10 October 1999 - 10:30 AM

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


#7 SikCiv   Members   -  Reputation: 122

Like
Likes
Like

Posted 10 October 1999 - 07:55 PM

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.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS