So I didn't touch my code for a couple of days, but I'm SURE it was working. However I've come back to it to try and fix the sizing issue once and for all but when I ran it (without changing anything today), it looks like this:
To clarify, the purple sprite should have the red and white dotted line on the top only, not the bottom, and part of it seems to have been spliced part way across the screen. Does anyone have any ideas what I may have changed to cause this? I've not touched the vertices aspects of the code, etc for a while as I've been working on the client width thing. So far I can't think what I've done wrong.
EDIT: I've found what was causing it, it's because I'd force-enabled anti-aliasing with the Catalyst Control Center (for something else). It seems my application didn't like that. :S
Setting it back to Application Preference fixed it.
EDIT2: I'm still struggling with trying to get the damned client size correct though.
I first have a RECT with the following:
windowRect.left = GetSystemMetrics(SM_CXSCREEN)/2-window_width/2
windowRect.top = GetSystemMetrics(SM_CYSCREEN)/2-window_height/2;
windowRect.right = window_width;
windowRect.bottom = window_height
Which sets the values:
left = 328
top = 141
right = 1024
bottom = 768
Following AdjustWindowRect() being called with the following arguments:
AdjustWindowRect(&windowRect, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN/*WS_EX_TOPMOST | WS_POPUP*/, NULL)
Which adjusts the original values to the following:
left = 320
top = 111
right = 1032
bottom = 776
The window is then created using those values like this:
CreateWindowEx
(
0,
szAppName,
windowTitle,
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
windowRect.left,
windowRect.top,
windowRect.right,
windowRect.bottom,
GetDesktopWindow(),
NULL,
wc.hInstance,
NULL))==NULL)
Then, in my rendering code I have:
d3dDisplayMode.Width = window_width;
d3dDisplayMode.Height = window_height;
d3dPresentationParameters.BackBufferWidth = d3dDisplayMode.Width;
d3dPresentationParameters.BackBufferHeight = d3dDisplayMode.Height;
(window_width is still 1024 and window_height is still 768).
The issue still exists with what I'm doing here, but I'm not sure what I'm doing wrong. The client area SHOULD be 1024x768, which is what I should be setting d3dDisplayMode.Width and d3dDisplayMode.Height with, and d3dPresentationParameters.BackBufferWidth and d3dPresentationParameters.BackBufferHeight with, right?
I cannot see where I'm going wrong.