|
Okay, the View classes are great, but I'm having one hell-uv-a-time
trying to get something to work properly that I *need* to work
properly. :-)
After the window is created and displayed, I need to adjust the size of
it, because the size is wrong when first displayed. In C, this would be
done like so:
RECT cr;
DWORD style, styleEx;
GetClientRect(hWnd, &cr);
style = GetWindowLong(hWnd, GWL_STYLE);
styleEx = GetWindowLong(hWnd, GWL_EXSTYLE);
AdjustWindowRectEx(&cr, style, FALSE, styleEx);
Now 'cr' contains the *real* desired size of the window. Originally, if
I specify the window should be 800x600, when it's created, that
includes all the "fluff" as well - frame, menubar (if there is one),
etc. We adjust the rectangle to compensate for this and then resize the
window so that the actual "viewport" area is proper:
int width = cr.right - cr.left + 1;
int height = cr.bottom - cr.top + 1;
SetWindowPos(hWnd, NULL, 0, 0, width, height, SWP_NOMOVE |
SWP_NOZOREDER);
Phew. Too much C. Now, I can do all of this with the UserLibrary and
all the code works, except that the SetWindowPos doesn't actually seem
to do anything. I do all of this in #onViewCreated, which could
possibly be the problem (I actually don't know the order of events in
Dolphin - in C I would do this right before ShowWindow). I've tried
using #width: and #height:, but none of these appear to actually work.
I can confirm 100% that the view is not the correct size, because
rendering a square in the viewport is not a *real* square (note: this
is rendering with Direct3D, not GDI which deals with pixels and not
projections).
Any helpful hints appreciated. Thanks!
Jeff M.
|