[fixed]Irrlicht being created on existing HWND

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Aspiring
Posts: 6
Joined: Fri May 09, 2008 1:43 am

[fixed]Irrlicht being created on existing HWND

Post by Aspiring »

There is an annoying bug in your engine that results after creating Irrlicht on an existing Win32 window that was created with styles such as WS_SYSMENU.

It is in file "CIrrDeviceWin32.cpp" at line 376.

Code: Select all

else if (CreationParams.WindowId)
{
	// attach external window
	HWnd = static_cast<HWND>(CreationParams.WindowId);
	RECT r;
	GetWindowRect(HWnd, &r);
	CreationParams.WindowSize.Width = r.right - r.left;
	CreationParams.WindowSize.Height = r.bottom - r.top;
	CreationParams.Fullscreen = false;
	ExternalWindow = true;
}
The 'GetWindowRect' should be 'GetClientRect'. GetWindowRect gets the area of the entire window including the bar at the top and the border. Thus Irrlicht thinks the render target is larger than it is, which messes up coordinates.

When I changed it and recompiled Irrlicht.dll, my program worked fine, before that it was rendering things slightly off, so it is definitely not my code.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Tracking, pending test case.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Post Reply