Jump to content
  • Advertisement

Archived

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

BeanDog

Wierd DInput Mouse troubles????!!!!

This topic is 6924 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just recently started having this problem. I made no changes to any DInput stuff during this time, although I did put my primary and back surface into system memory (640x480x16bpp), where I put down my cursor sprite. Here is my input code I use every frame: mState = MouseState(hwnd, Mouse); if (mState.lZ == 9999) Ending = true; MouseX+=mState.lX; MouseY+=mState.lY; if (MouseX < 0) MouseX = 0; if (MouseY < 0) MouseY = 0; if (MouseX > 640) MouseX = 640; if (MouseY > 480) MouseY = 480; DIMOUSESTATE MouseState( HWND hDlg, LPDIRECTINPUTDEVICE7 &Mouse ) { DIMOUSESTATE dims; HRESULT hr; if (NULL != Mouse) { hr = DIERR_INPUTLOST; while ( DIERR_INPUTLOST == hr ) { hr = Mouse->GetDeviceState( sizeof(dims), &dims ); if ( hr == DIERR_INPUTLOST ) { hr = Mouse->Acquire(); if ( FAILED(hr) ) dims.lZ = 9999; } } if ( FAILED(hr) ) dims.lZ = 9999; } return dims; } Whenever I move my mouse to or past the far left of the screen, it boots me from the program. It does not boot me if I move too far up, down, or right. ANYBODY EVER HAVE THIS HAPPEN B4??? ~BenDilts(NULL* Intelligence); Bean Dog

Share this post


Link to post
Share on other sites
Advertisement

i whis i knew HOW did u put ur primary and backbuffer in system memory ...this is funny...they are supposed to BE in videomemory at all times....

maybe this is the mistake?

Share this post


Link to post
Share on other sites
check the coordinates at which you are drawing your cursor, you may be trying to draw it beyond the boundaries of the screen.

+AA_970+

Share this post


Link to post
Share on other sites
quote:

if (MouseX > 640)
MouseX = 640;
if (MouseY > 480)
MouseY = 480;



Your screen is 640 x 480, so that means the coordinates are from 0-639 and 0-479, not 0-640 and 0-480. You're one pixel too far (in invalid mem) when you move to the right or bottom edge.

Also, you shouldn't be hardcoding these numbers.

aig

Edited by - An Irritable Gent on 5/4/00 9:21:41 PM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!