dxinput mouse question

Started by
4 comments, last by logout 20 years, 2 months ago
How can i get the screen coordinates with directinput ? *im using dx8* As it is now i only recv the offset from the last input i pluss this with my cursor pos to get a picture of where i am on the screen. this works fine for moving the cursor but not for collition detection
Advertisement
You define where the mouse is since it has no idea that the screen even exists. Call some point on the screen (probably the top left corner) to place your mouse initially, call it point (0, 0) ,and then reference all mouse moves from that point.

Using that, when your mouse has a net movement of (400, 30) you know that the screen coordinate is (400, 30).

Colin Jeanne | Invader''s Realm

Also, if you''re having lots of problems with that, you can also use the Windows API function GetCursorPos.

.bas

[sPiKie] mmorpg isnt hard in vb
.basprintf ( "And for the %dth time, I'm not American!", ++lIdiots );My homepage
so how do i detect mouse clicks with GetCursorPos() ?


Invader X:
How would you go around doing that ?

int x = 0;int y = 0;//now in my update input function that gets called every framex += m_MouseState.lX;y += m_MouseState.lY; 

or what ?
quote:Original post by logout
Invader X:
How would you go around doing that ?

int x = 0;int y = 0;//now in my update input function that gets called every framex += m_MouseState.lX;y += m_MouseState.lY;  

or what ?

Exactly like that. If you find that the mouse is too sensitive or not sensitive enough you can make the equations a bit more complex. Windows, for example, simulates acceleration when it decides the mouse position.

Colin Jeanne | Invader''s Realm
quote:Original post by Invader X
quote:Original post by logout
Invader X:
How would you go around doing that ?

int x = 0;int y = 0;//now in my update input function that gets called every framex += m_MouseState.lX;y += m_MouseState.lY;   

or what ?

Exactly like that. If you find that the mouse is too sensitive or not sensitive enough you can make the equations a bit more complex. Windows, for example, simulates acceleration when it decides the mouse position.

Colin Jeanne | Invader''s Realm


I think by default there is no acceleration.

And the rockets' red glare, the bombs bursting in air,gave proof through the fight that our flag was still there.Oh say, does that star-spangled banner yet waveover the land of the free and the home of the brave?

This topic is closed to new replies.

Advertisement