Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to enhance Homeworld 2 gameplay with touch gestures. The game is running on Windows.

So, two questions:

  1. Is it possible to wrap the game with a program that would capture touch gestures, convert it to keyboard and mouse input and send it to the game?
  2. How would I approach this task? Using 3rd party libraries, making my own, or something built in to Windows?
share|improve this question
Why not ask the developers of Homeworld Touch? I think this question isn't a good fit for the site, since it's a which technology to use question and this isn't the place for recruiting. Check out the FAQ, there's some sites listed there that would be a better fit for such questions. – Byte56 Mar 14 '13 at 17:03
Because we are not working on the same game nor even the same platform? They are doing Homeworld 1 (source code released) and I am doing the sequel (no source code available). Also they are doing iOS and I am doing Windows – pilau Mar 14 '13 at 17:23
OK pilau. I was mostly linking it because I thought you might be interested. See the remainder of my comment above. – Byte56 Mar 14 '13 at 17:26
I am, thank you :) – pilau Mar 14 '13 at 17:39
I've edited the question to be more general and removed the "which technology to use" direct question and the request for people to join the project. If you feel like this edit is too drastic, please revert it. However, I think it'll make it more answerable. – Byte56 Mar 14 '13 at 18:28
up vote 2 down vote accepted

Yes it is likely possible. What you need to do is hook the mouse, (basically the same thing key loggers and event monitors do), interpret the mouse motions in your process, and then simulate event input to the Homeworld 2 window using SendMessage.

What should happen is you should be able to attach your app as a kind of "virtual keyboard" into the Homeworld 2 game window, and the commands you send via SendMessage need to be picked up by the game, as if the player were pressing those keys on the keyboard.

This may take some experimentation and implementation is unlikely to be as straightforward as it sounds here.

share|improve this answer
Thanks. It says: 'SetWindowsHookEx can be used to inject a DLL into another process'. So you can inject a DLL into any application, just like that? It also says 'Before terminating, an application must call the UnhookWindowsHookEx function to free system resources' which application should do it? The hooker or the hookee? (Lame wording choice, I know. :P) – pilau Mar 14 '13 at 21:41
It seems kind of unbelieveable, eh? But the functionality is there. I was thinking about a global hook, where you just monitor the entire system for events, then use SendMessage to "manufacture" the correct inputs for Homeworld, based on the information you learned in your HookProc. The hooker has to unhook itself! The hookee may be unaware it is being hooked. – bobobobo Mar 14 '13 at 22:50
Lol that wordplay is just hilarious. Yes, and to build on our pun-demic, it's as if SetWindowsHookEx reads "exploit me". Okay, I'm over the top now. Thanks for your help! Now just need to find a good gesture library in .net ;) – pilau Mar 15 '13 at 2:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.