Problems with client coordinates in windowed mode.
Posted: Sat Oct 13, 2007 3:44 pm
Hello,
I'm trying to pass my windows messages to the irrlicht device using the postEventFromUser function, but when I'm in windowed mode, irrlicht seems to be using the part of the window under the title bar as well giving me confusing mouse coordinate results. I need to move my mouse the title-bar-height under every gui component to activate it and I strongly believe that irrlicht is rendering under the title bar as well.
Here's a simplified version of what I do:
And
Now if I add a GUI component on the screen like:
I notice that the window is a title-bar-height away from the bottom of the window, making me believe that irrlicht is actually rendering under the title bar as well, and not only in the client area of the window.
Can someone help me out with this? How do I handle this correctly?
Cheers,
Dirk.
I'm trying to pass my windows messages to the irrlicht device using the postEventFromUser function, but when I'm in windowed mode, irrlicht seems to be using the part of the window under the title bar as well giving me confusing mouse coordinate results. I need to move my mouse the title-bar-height under every gui component to activate it and I strongly believe that irrlicht is rendering under the title bar as well.
Here's a simplified version of what I do:
Code: Select all
RECT r;
r.left = 0;
r.top = 0;
r.right = g_resX;
r.bottom = g_resY;
AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, false);
HWND hWnd = CreateWindow(g_windowClass, g_windowTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, r.right - r.left, r.bottom - r.top, NULL, NULL, hInstance, NULL);
...
SIrrlichtCreationParameters devParms;
devParms.AntiAlias = true;
devParms.Bits = 32;
devParms.DriverType = EDT_OPENGL;
devParms.EventReceiver = &receiver;
devParms.Fullscreen = false;
devParms.HighPrecisionFPU = false;
devParms.SDK_version_do_not_use = IRRLICHT_SDK_VERSION;
devParms.Stencilbuffer = true;
devParms.Vsync = false;
devParms.WindowId = (void*)hWnd;
devParms.WindowSize = dimension2d<s32>(g_resX, g_resY);
g_dev = createDeviceEx(devParms);
...
Code: Select all
switch (message)
{
case WM_MOUSEMOVE:
ev.EventType = EET_MOUSE_INPUT_EVENT;
ev.MouseInput.Event = EMIE_MOUSE_MOVED;
ev.MouseInput.X = GET_X_LPARAM(lParam);
ev.MouseInput.Y = GET_Y_LPARAM(lParam);
if (g_dev)
g_dev->postEventFromUser(ev);
break;
Code: Select all
gui->addWindow(rect<int>(10, g_resY - 150, 320, g_resY), false, L"Fix log");
Can someone help me out with this? How do I handle this correctly?
Cheers,
Dirk.