Skip to main content
GameDev.net gamedev.net
🔒 Locked

Problem with DirectInput and Bounding Boxes

Started by hype261 Oct 14, 2008 at 6:32 PM 0 replies 600+ views
Original Post
hype261
hype261
Okay I am trying to create a game editor of sorts for my 2d game. I created some meshes and created a bounding box so I could tell if the mouse was over the bounding box. Everything works perfectly with the exception that when I move the mesh with the mouse the farther away the mesh gets from center the mesh outpaces the mouse cursor. So if the mesh is at the top of the screen the place I have to click to move it is below it. Does anybody know why this would occur?
Evil Steve
Evil Steve
First, don't use DirectInput for keyboard or mouse input, that's a really bad idea.

As for the actual problem, I'd guess that your client area isn't the same as the backbuffer size because you're running in windowed mode and didn't use AdjustWindowRect[Ex] to get the correct size for your window when you created it.
CreateWindow[Ex] takes the window size as parameters, not the client area size. So if you pass 800, 600 as width, height you'll get a window that's 800x600, but a drawable area (client area) which is smaller, something like 762x584. That means that any mouse picking will be off slightly, can introduce graphical glitches, and it's slightly less performant than having a client rect that's the same size as the backbuffer.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.