(C++) Win32 window and resolution

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Post Reply
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

(C++) Win32 window and resolution

Post by Acki »

Hi,
I was asked to post the changes for this here !!!

The problem is that if you create an Irrlicht device inside a win32 window (like tutorial #14-Win32Window), the resolution from the creation parameter does not have any affect !!!
No matter what resolution you choose, Irrlicht takes the desktop resolution !!!

The problem is within the constructor from the CIrrDeviceWin32.cpp file...
Open this file and search for this code (about line 355):

Code: Select all

  // attach external window
  if (externalWindow)
  {
    HWnd = externalWindow;
    RECT r;
    GetWindowRect(HWnd, &r);
    windowSize.Width = r.right - r.left;
    windowSize.Height = r.bottom - r.top;
    fullscreen = false;
    ExternalWindow = true;
  }
and change this code to:

Code: Select all

  // attach external window
  if (externalWindow)
  {
    HWnd = externalWindow;
//    RECT r;
//    GetWindowRect(HWnd, &r);
//    windowSize.Width = r.right - r.left;
//    windowSize.Height = r.bottom - r.top;
    fullscreen = false;
    ExternalWindow = true;
  }
Now recompile Irrlicht and you can create a win32 device with any resolution you want to !!! 8)

CU, Acki
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply