Archived

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

logout

dxinput mouse question

Recommended Posts

logout    122
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

Share this post


Link to post
Share on other sites
Colin Jeanne    1114
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

Share this post


Link to post
Share on other sites
bastardos    100

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

Share this post


Link to post
Share on other sites
logout    122
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 frame
x += m_MouseState.lX;
y += m_MouseState.lY;


or what ?

Share this post


Link to post
Share on other sites
Colin Jeanne    1114
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 frame
x += 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

Share this post


Link to post
Share on other sites
PlayGGY    122
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 frame
x += 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.

Share this post


Link to post
Share on other sites