StretchRect(directX) not drawing all pixels?

Started by
1 comment, last by gav86 18 years, 8 months ago
Well i'm sure its a simple numbers thing that I have overlooked... But I just cant 'see' it in the code.. I'm drawing 4 squares of 10*10 pixels, from a bitmap that is 40 pixels wide, 10 high. *edit* forgot to include the actual problem: the bottom line of pixels is not being drawn .. ie it only seems to be going down to the 9th pixel. here is the code..

for(int i = 0; i<4 ; i++)
{

	RECT source;
	RECT destination;

	source.top = 0;
	source.bottom = 10;
	source.left = i*10;	
	source.right = i*10 + 10;

	destination.top = 100;
	destination.bottom = 110;
	destination.left = i*10 + 10*i;
	destination.right = i*10 + 10*i + 10;

	hResult = pd3dDevice->StretchRect( squaresSurface,
   					 &source,
					 backbuffer,
					 &destination,
					 D3DTEXF_NONE );
}
As a starting point, does an image start counting at pixel 0 or 1?
Advertisement
are you trying to draw a small image or a background?
if its a small image, try using the ID3DXSprite Interface
if you havent already, i used that for the smaller images and stretcrect for my backgrounds and menus
Ah OK thanks, I hadn't looked into sprites yet but it's probably more suited to what I'm doing.

Basically I'm trying to set up the block/square drawing section of a tetris clone - although I am currently only in the design phase of it. . figuring out the structure of the program etc..

This topic is closed to new replies.

Advertisement