Tuesday, December 3, 2013

Cursor Lock, Keep the Mouse Within the Application Window

If you have played any RTS(Real Time Strategy, ie. Starcraft, Age of Empires, Command & Conquer, etc.) game it's common knowledge you mainly move around the map by dragging your mouse to the edges of the window.  Well, I recently started playing an older RTS game, in windowed mode, and the mouse wasn't being locked within the application window which was really annoying.  Even when the game was fullscreen it wouldn't work because I have a dual screen setup.  After a quick Google search I stumbled upon an app called Cursor Lock.  The idea is simple, it locks your mouse cursor within the application window.  In my case I use a hotkey to turn on/off the cursor lock.  Below are the steps on how I set it up:

First download it from here and install it.

The first thing I did was set a hotkey to turn on/off the cursor lock.  I set it to something I wouldn't normally press during a game which is the Pause key.
Next go to Shortcut and select User Mode.  Then make sure to select the Lock Region checkbox and set it to Window Interior.
Again, this is for setting it up for a Windowed Mode game.  A fullscreen game when using more than one monitor may not use the same settings.

The Window option, as opposed to Window Interior, would allow you to resize the window since your mouse can move to the edges of the window, while the Window Interior option will just keep the mouse within the window which would prevent any resizing misclicks.

Once you have that setup you can test it to make sure it works.  Remember to trigger your hotkey if it doesn't lock within the Cursor Lock window.

Now that it works you click the Create Shortcut button and name it whatever you wish.  I saved the shortcut to my Desktop which I then copied over to my Startup folder (You can access the Startup folder by going to Start>All Programs>Right click the Startup folder and drag the shortcut into that folder).  Now when I boot into Windows the application will automatically run and I can trigger the hotkey whenever I want to lock the cursor.

Older Games:
I have recently been playing an older RTS, C&C Generals Zero Hour, and unfortunately the cursor lock program did not work when in Windowed Mode.  The cursor was being locked to the window but wouldn't pan the camera at all.

There still is an issue with full screen mode when using 2 monitors.  The current fix I am using is to just disable to 2nd monitor with Windows.  It's a lot better than unplugging it.  Below are the steps on how to easily accomplish this:

Right click on your Desktop and go to Screen Resolution.

Then choose to Show desktop only on X on the Multiple displays option.
This will disable the 2nd monitor and allow you pan around the map correctly within the game.

Hope this helps.

*The Program Mode allows you to create a shortcut which will also open whichever game you assign.  I prefer to use a hotkey instead of having multiple game shortcuts.

2 comments: