Jump to content
  • Advertisement

Archived

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

Can't get the game backround to look right

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

Well, hello there. My problem is that i try to make a 640*480 window(not fullscreen) with a 640*480 pixture as background.(DX8) When i load the picture and draw it a small part of the picture in the right and the bottom is gone. Also, the picture is blurry. 1. The window''s not the right size. I think that the window including borders is 640*480 and i don''t know how to fix so only the drawing area is 640*480. I use this function to initialise the window: HWND hWnd = CreateWindow("Game", "Game test", WS_BORDER|WS_SYSMENU|WS_MINIMIZEBOX , 50, 50, 640, 480, GetDesktopWindow(), NULL, wc.hInstance, NULL); 2. I can''t turn off the texture filters, even if i try the picture gets blurry. I use g_pD3DDevice->SetTextureStageState(0, D3DTSS_MAGFILTER , D3DTEXF_NONE); g_pD3DDevice->SetTextureStageState(0, D3DTSS_MIPFILTER , D3DTEXF_NONE); g_pD3DDevice->SetTextureStageState(0, D3DTSS_MAGFILTER , D3DTEXF_NONE); doesn''t work though. Please tell me what''s wrong

Share this post


Link to post
Share on other sites
Advertisement
Your first problem is easy enough: first, get the size of the window using "GetWindowRect", then, get the size of the client area using "GetClientRect". Determine the difference (which is basically the size of the borders), add it to your desired client area size and call "SetWindowPos" to make your window the appropriate size.

Share this post


Link to post
Share on other sites
You can use AdjustWindowRect before creating window


RECT rect = { 0, 0, WindowWidth, WindowHeight };
AdjustWindowRectEx( &rect, dwStyles, false, 0 );
// then in CreateWindow() you use:


rect.right + abs(rect.left), // Window Width

rect.bottom + abs(rect.top), // Window Height


// to set the size



Share this post


Link to post
Share on other sites
oh and AdjustRect() dosnt understad WS_OVERLAPPED so use:

WS_POPUP | WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX


if you want to make a window that is not resizeable

Share this post


Link to post
Share on other sites
First problem solved. Now for the second problem. As i told you, it won''t render it without blurring it alot. I''ve tried to turn the texture filters off, but i can''t. If you see this picture you''ll hopefully know what i mean(the left one is how i want it, the right one is as it renders)

http://fhhsfbla.org/anim8or/jatel/havetofixthis.PNG

I really need help

Share this post


Link to post
Share on other sites
Well, i know what antialiasing is, but i don''t want the antialiasing to be there. I just want the background to look exactly as it does in the *.bmp file.

Share this post


Link to post
Share on other sites
Now i have almost solved the second problem. I think i know where the problem is, the hard bit is to solve it. when i change the following row:

D3DXCreateTextureFromFileEx(*g_pD3DDevice, texturepath,640,480,D3DX_DEFAULT,0,D3DFMT_UNKNOWN,D3DPOOL_MANAGED,D3DX_DEFAULT,D3DX_FILTER_NONE ,0xFFFF00FF,NULL,NULL,&bg_texture);

into

D3DXCreateTextureFromFileEx(*g_pD3DDevice, texturepath,640,480,D3DX_DEFAULT,0,D3DFMT_UNKNOWN,D3DPOOL_MANAGED,D3DX_FILTER_NONE,D3DX_FILTER_NONE ,0xFFFF00FF,NULL,NULL,&bg_texture);

the picture shrinks alot and gets really weird. I don't know what to do, why it isn't working. I don't think my 3d coordinates are wrong but tell me if you think they are:

pVertices[0].x = 0.0f;
pVertices[0].y = 480.0f;
pVertices[1].x = 0.0f;
pVertices[1].y = 0.0f;
pVertices[2].x = 640.0f;
pVertices[2].y = 0.0f;
pVertices[3].x = 640.0f;
pVertices[3].y = 480.0f;

pVertices[0].z = 1.0f;
pVertices[1].z = 1.0f;
pVertices[2].z = 1.0f;
pVertices[3].z = 1.0f;

pVertices[0].rhw = 1.0f;
pVertices[1].rhw = 1.0f;
pVertices[2].rhw = 1.0f;
pVertices[3].rhw = 1.0f;

[edited by - MuruGuru on November 18, 2003 2:50:53 PM]

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!