-
August 10th, 2013, 01:53 AM
#1
Moving mouse position
I am writing a program to map keyboard and mouse to an xbox 360 controller with win32 and xinput. I have everything going fine but when im trying to control the mouse with the thumbsticks I get problems with the movement if my program has the focus it moves fine but when I put another window in focus the movement is over sensitive here is the code I am using
Code:
if(_controllerState.Gamepad.sThumbRX >= XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)
{
GetCursorPos(&mousepos);
profile->Buttons[6]->input.type = INPUT_MOUSE;
profile->Buttons[6]->input.mi.dwExtraInfo = GetMessageExtraInfo();
profile->Buttons[6]->input.mi.time = 0;
profile->Buttons[6]->input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK;
profile->Buttons[6]->input.mi.mouseData = 0;
profile->Buttons[6]->input.mi.dx = mousepos.x * (65535.0f / GetSystemMetrics(SM_CXSCREEN));
profile->Buttons[6]->input.mi.dy = mousepos.y * (65535.0f / GetSystemMetrics(SM_CYSCREEN));
SendInput(1, &profile->Buttons[6]->input, sizeof(INPUT));
}
I have tried everything to fix it any advice.
-
August 12th, 2013, 01:48 AM
#2
Re: Moving mouse position
Originally Posted by william3711
I am writing a program to map keyboard and mouse to an xbox 360 controller with win32 and xinput. I have everything going fine but when im trying to control the mouse with the thumbsticks I get problems with the movement if my program has the focus it moves fine but when I put another window in focus the movement is over sensitive here is the code I am using
Code:
if(_controllerState.Gamepad.sThumbRX >= XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)
{
GetCursorPos(&mousepos);
profile->Buttons[6]->input.type = INPUT_MOUSE;
profile->Buttons[6]->input.mi.dwExtraInfo = GetMessageExtraInfo();
profile->Buttons[6]->input.mi.time = 0;
profile->Buttons[6]->input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK;
profile->Buttons[6]->input.mi.mouseData = 0;
profile->Buttons[6]->input.mi.dx = mousepos.x * (65535.0f / GetSystemMetrics(SM_CXSCREEN));
profile->Buttons[6]->input.mi.dy = mousepos.y * (65535.0f / GetSystemMetrics(SM_CYSCREEN));
SendInput(1, &profile->Buttons[6]->input, sizeof(INPUT));
}
I have tried everything to fix it any advice.
In principle, you could move the mouse position with SetCursorPos ... you should can move it, or else you have another issue ..
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|