Speed issues

Started by
15 comments, last by d_prodigy 22 years, 9 months ago
El duderino: Good suggestion. Im trying it out rightaway.

I know some cards doesnt support BltFast but in those cases I thought directdraw emulated it for you... I cant even use the function. I use this line:
lpddsMapView->BltFast(400, 500, lpddsBasicTileSet[NR_WATER_1], NULL, DDBLTFAST_WAIT);

and it fails...
Why??
Advertisement
It''s been a while since I used ddraw, but I believe you have your paramaters set up incorrectly. Look up the docs on bltfast again and make sure you are passing args in the correct order,
Zen
Those args seem in the right order.

What dimentions are the lpddsMapView and lpddsBasicTileSet[NR_WATER_1] surfaces ?

If putting the water there at 400, 500 means that *any* pixels are off the MapView surface, nothing will get blitted.

El Duderino
On the fly clipping is basically this:

1. Before you actually blit check to see that the destination puts the tile entirely on the screen. If it doesn''t do the following.

2. See how far off the screen it is. If the destination puts the tile completely off the screen then just skip it and move to the next otherwise move to the next step.

3. See how far off the screen it is the adjust where you grab it from the offscreen surface. If it''s two pixels too far off the right side, shorten the ImageRect.right two pixels. And so forth. The left and top are a little more complicated since you then have to adjust where it''s placed as well.

Ben
http://therabbithole.redback.inficad.com
If what you are saying is true KalvinB, it is *very* good news.

However, AFAIK only the blt function allows you the freedom to manipulate the dest and source RECTs. Bltfast does not, you just pass a single x,y co-ord and that''s that, surface gets smacked on surface no-frills.

I''d be pleased to hear different.

El Duderino
I seem to recall that BltFast takes width and height parameters, which are pretty much the same thing as passing in a rectangle anyway.
get TANSTAAFLs book on isometric programming. I have an example source code and program on the cd, called "TBS for Contest" (I thought TANSTAAFL would change the name, hehe). I use bltfast and do my own clipping. Its much faster and better then using blt. Here is how it works:

        RECT rect;rect.left   = 0;rect.right  = IMAGE_WIDTH;rect.top	    = 0;rect.bottom = IMAGE_HEIGHT;lpDDSBack->BltFast(x_pos_on_screen, y_pos_on_screen, UnexploredTile_surf, &rect, DDBLTFAST_WAIT | DDBLTFAST_SRCCOLORKEY);        


The RECT is used for clipping the image. This example here will blit that whole bitmap. But you would use the RECT to select the portions of the bitmap that you want to see, for example, if half of the tile was off of the screen, you would use the RECT to select just the pixels of the bitmap that will appear on the screen.

In the demo on the cd, I basically make a civ2 engine, but using hexagons.

Possibility

Edited by - Possibility on July 9, 2001 4:19:18 AM

This topic is closed to new replies.

Advertisement