🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

DirectInput question

Started by
0 comments, last by uncreativ 24 years, 5 months ago
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
Advertisement
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;    

This topic is closed to new replies.

Advertisement