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

DirectInput question

Started by uncreativ Jan 13, 2000 at 8:18 PM 0 replies 600+ views
Original Post
uncreativ
uncreativ
hello, i just got DirectInput to work correctly, and when i read in the mouse co-ordinates they are zero based when the cursor is in the middle of the screen. what i''m trying to do is convert these coordinates so they are relative to the upper left corner of the screen. anyone have an idea on how i can achieve this? -uncreativ
-uncreativpresidenthalosoft, inc.halosoft.hypermart.net
Melo
Melo
I''m not sure about the problem, but this should work fine:

Mouse.x += dims.lX * MouseSensivity / 10;
Mouse.y += dims.lY * MouseSensivity / 10;

if (Mouse.x < 0) Mouse.x = 0; // Avoid the mouse-cursor to leave the screen (or another area)
if (Mouse.y < 0) Mouse.y = 0;
if (Mouse.x >= 640) Mouse.x = 639;
if (Mouse.y >= 480) Mouse.y = 479;

Topic Locked

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

Sign in to reply to this topic.