4
« on: June 28, 2008, 03:12:50 am »
ok here we go this was the only part i needed to change,
////////////////////////////////////////////////////////////
/// Create the window implementation
////////////////////////////////////////////////////////////
WindowImplWin32::WindowImplWin32(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& Params) :
myHandle (NULL),
myCallback (0),
myCursor (NULL),
myKeyRepeatEnabled(true)
{
// Register the window class at first call
if (ourWindowCount == 0)
RegisterWindowClass();
// changes here
int Left = (GetDeviceCaps(GetDC(NULL), HORZRES) - Mode.Width) / 2;
int Top = (GetDeviceCaps(GetDC(NULL), VERTRES) - Mode.Height) / 2;
//first calculate outer dimension
int Width = Mode.Width;
int Height = Mode.Height;
//
//then calculate dimensions of render view
myWidth = Width - (2*GetSystemMetrics( SM_CXSIZEFRAME ));
myHeight = Height - (2*GetSystemMetrics( SM_CYSIZEFRAME )) - GetSystemMetrics( SM_CYCAPTION );
// Choose the window style according to the Style parameter
DWORD Win32Style = WS_VISIBLE;
if (WindowStyle == Style::None)
{
Win32Style |= WS_POPUP;
}
else
{
if (WindowStyle & Style::Titlebar) Win32Style |= WS_CAPTION | WS_MINIMIZEBOX;
if (WindowStyle & Style::Resize) Win32Style |= WS_THICKFRAME | WS_MAXIMIZEBOX;
if (WindowStyle & Style::Close) Win32Style |= WS_SYSMENU;
}
// In windowed mode, adjust width and height so that window will have the requested client area
bool Fullscreen = (WindowStyle & Style::Fullscreen) != 0;
/* if (!Fullscreen)
REMOVED THIS AND OPTED FOR TOP AS IT WAS THROWING OUT, I THINK,EITHER WAY NOT NEEDED
*/
// Create the window
if (HasUnicodeSupport())
{
wchar_t WTitle[256];
int NbChars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, Title.c_str(), static_cast<int>(Title.size()), WTitle, sizeof(WTitle) / sizeof(*WTitle));
WTitle[NbChars] = L'\0';
myHandle = CreateWindowW(ourClassNameW, WTitle, Win32Style, Left, Top, Width, Height, NULL, NULL, GetModuleHandle(NULL), this);
}
else
{
myHandle = CreateWindowA(ourClassNameA, Title.c_str(), Win32Style, Left, Top, Width, Height, NULL, NULL, GetModuleHandle(NULL), this);
}
i checked the resize event and that is fine, and is the only other place that i could see that myWidth/myHeight was being changed,
also checked fullscreen mode and seemed to work just fine,
later.