Sign in to follow this  

Direct3D Surfaces will not draw the whole window.

This topic is 4483 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

I thought I was starting to get the hang of this, but I guess not :D. Anyways, I'm sort of lost as to what my problem is here. As my topic says, I can't get tiles to consume the entire window. I do not have this problem in Full Screen mode. I've read something about the difference between width and pitch, is that what's going on in my case? This is a pic my my problem. www.everyrpg.com/showExp.jpg This code is crammed into my message loop.
[source lang=c++]{
	int x = 10;
	int y = 10;
	d3ddev->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_XRGB(0,255,255), 1.0f,0);
	RECT dest;
	RECT src;
	src.bottom	= 64;
	src.top		= 0;
	src.left	= 0;
	src.right	= 64;
	dest.bottom = 64;
	dest.top	= 0;
	dest.left	= 0;
	dest.right	= 64;
	
	d3ddev->BeginScene();
	for(int j=0; j<=y; j++)
	{
		for(int i =0 ; i<=x; i++)
		{
			d3ddev->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,&backbuffer);
			d3ddev->StretchRect(surface,&src,backbuffer,&dest,D3DTEXF_NONE);	

			dest.left	+= 64;
			dest.right	+= 64;
		
		}
		dest.top	+=64;
		dest.bottom +=64;
		dest.left	= 0;
		dest.right	= 64;
	}

	d3ddev->EndScene();
	d3ddev->Present(NULL,NULL,NULL,NULL);

}

Share this post


Link to post
Share on other sites
I had a similar problem, when drawing to a picture in window mode.
Keep in mind, that also your window has a size of 640x480 your surface is something smaller, and stretchRect seems not to draw pictures, which have a part out of the surface boundaries...
For one thing just try to change your offset of 64 to 62 and see how it looks then...

Share this post


Link to post
Share on other sites
Well, I'm not sure what the problem was with what I was doing really. However, I got to thinkin I'm eventually going to want it scroll, so why not draw to a surface that's bigger than my display area. That the only way I could see to accomplish that, turns out that fixed my problem as well :D. Here my updated code, I just created a new temp surface to build up in the for loops then grabbed the portion I needed from that and then displayed that to the backbuffer. It liked that :D. Don't know why I couldn't just write to the backbuffer, oh well. I was probably doing something wrong and I'll figure it out weeks from now, but I'll live with this solution for now :D. Thanks for your tip, got me thinkin'.

[source lang=c++]
{
int x = 19;
int y = 15;
d3ddev->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_XRGB(0,255,255), 1.0f,0);
d3ddev->ColorFill(worldDraw,NULL,D3DCOLOR_XRGB(255,0,255));
d3ddev->ColorFill(backbuffer, NULL, D3DCOLOR_XRGB(255,0,255));
RECT dest;
RECT src;
src.bottom = 64;
src.top = 0;
src.left = 0;
src.right = 64;
dest.bottom = 64;
dest.top = 0;
dest.left = 0;
dest.right = 64;

d3ddev->BeginScene();
for(int j=0; j<=y; j++)
{
for(int i =0 ; i<=x; i++)
{
d3ddev->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,&backbuffer);
d3ddev->StretchRect(surface,&src,worldDraw,&dest,D3DTEXF_NONE);

dest.left += 64;
dest.right += 64;

}
dest.top +=64;
dest.bottom +=64;
dest.left = 0;
dest.right = 64;
}

RECT newsrc;
newsrc.bottom = 1024;
newsrc.top = 0;
newsrc.left = 0;
newsrc.right = 1280;


d3ddev->StretchRect(worldDraw, &newsrc, backbuffer, NULL, D3DTEXF_NONE);
d3ddev->EndScene();
d3ddev->Present(NULL,NULL,NULL,NULL);

}

Share this post


Link to post
Share on other sites

This topic is 4483 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this