![]() WindowClass.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH) WindowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION) WindowClass.hCursor = LoadCursor(NULL, IDC_ARROW) WindowClass.style = CS_HREDRAW | CS_VREDRAW This is the code I use to create the window void Game::InitializeWindow(HINSTANCE hInstance) My function requires client area coordinates, the coordinates of the mouse cursor INSIDE the window, of course. So my question is, how come the coordinates don't cover the whole window size? Am I missing something/ doing something wrong? How can I get correct coordinates? The coordinates of the mouse cursor are not between 0 and the window width/height (1024 X 768 in my case), but the maximum width is 1004 and the maximum height is 718 (more or less when I click on the bottom right corner of the window), that's what I read when I debug the application.Ī final prove of that is that if I use those width and height in my code, objects are placed where they should. > Input::GetInstance()->Place(lParam & 0xFFFF, lParam > 16 & 0xFFFF, mCamera, mEntity, mTerrain, mRenderer) *MessageBox(mWindow, L"left mouse button clicked", L"CLICK", MB_OK) */ I'm implementing a ray casting routine to pick and place entities on a terrain, and all works fine except that when I try to place something on the ground it has a weird offset to the top and to the left:Īfter quite a bit of debugging I found out that my code works fine, and the issue is with the window coordinates that I send to the ray casting class/function: LRESULT Game::GameWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) ![]() I'm coding a simple game engine with DirectX11 and I'm using Win32 API to create a window and process user input.
0 Comments
Leave a Reply. |