• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Direct-input Mouse coords how subdue?!

## Recommended Posts

Impz0r    166
hi, I''m working current on a Direct3d based GUI and i use Direct-input for all the input exercises. So every GUI control has is own coordinates (sure *g*), so and wenn i would get the mouse coordinates, i became the relative distance from the last coordiante, fine, but how can i become the real cordinates, that i need to find out, whether the mouse is over some control or not. And a second problems came across, when i run my application in windowe mode, the coordinates matched not at all. What should i do, or better what did i wrong *g* Thanks alot... Mfg Impz0r

##### Share on other sites
darookie    1441
Well, I suppose you draw your own cursor so why not just
use a structure like this:

  struct { int x, y, dx, dy; float fac;} sMouse;

You initialize sMouse.x and sMouse.y with whatever values you
want and update them according to dx and dy:

  sMouse.x += (int)((sMouse.dx * fac) + 1.0f);sMouse.y += (int)((sMouse.dy * fac) + 1.0f);

This not only allows you to "lock" the mouse at your wish by
clipping x and y, you also can achieve different mouse
velocities.

##### Share on other sites
Impz0r    166
Is there a way to notice if the cursor over the current app window, and set then the cursor per Direct-Input to default position?! or better reset the Diret-Input values such a thing :D ?!

Thanks alot...

Mfg Impz0r