|
-
July 25th, 2013, 07:56 AM
#1
using SendInput to control mouse for games
Hello, I am making a program to map keys and mouse input to 360 controller using XInput I have the keys working fine with SendInput my problem comes from when I try to control the mouse pointer with the analog stick heres the code I was using for down direction on the left thumbstick this code is inside the message loop.
Code:
if(controller1->GetState().Gamepad.sThumbRX > XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)
{
GetCursorPos(&mouseposition);
mouseposition.x += controller1->GetState().Gamepad.sThumbRX/10000;
ip.type = INPUT_MOUSE;
ip.mi.dwExtraInfo = GetMessageExtraInfo();
ip.mi.mouseData = 0;
ip.mi.time = 0;
ip.mi.dx = mouseposition.x *(65536/screen_x);
ip.mi.dy = mouseposition.y *(65536/screen_y);
ip.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
SendInput(1, &ip,sizeof(INPUT));
}
the other directions generally follow the same idea.
it works fine outside of the stalker game im testing it with "not the best speed though" but in the game
if I move the thumbstick I get weird results. Example: Holding the thumbstickin the right direction and rotating on the game makes the movement stutter.
I have looked all over for an answer to why this happens but I cant find any examples of XInput with SendInput for controlling games.
Whats the problem and is there a better way than using SendInput?
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
|