0

I am making a gyro mouse. The driver script reads sensor input and moves mouse accordingly with win32api commands.

win32api.SetCursorPos((xStart-int(dh*xsensitivity),ypos))

When I open a full screen game such as Counter Strike Source, the mouse wont work at all. Only the click inputs function, but they cause to gun to point straight down and perform a kind of seizure.

Is there some way I can interface with whatever controls the mouse inside the game?

1 Answers1

2

I'm not terribly familiar with Windows programming, but my best guess is that the video game (Counter Strike) is using the DirectInput (from DirectX) methods to read mouse travel. That is, it's using DirectInput to get mouse motion events, and the Python win32api.SetCursorPos is "warping" the cursor to the given location and not generating ANY intermediate movement messages.

You'll most likely need to use the MS Win32 API call SendInput to construct mouse movement messages and push them into the event queue at the OS level.

If you're familiar with .NET technologies, you might try using IronPython (a Python interpreter that can interact with the .NET runtime). In such case, the Input Simulator project at Codeplex has methods defined for pushing mouse movement events into the input queue.

parselmouth
  • 1,598
  • 8
  • 8