Game Window Cursor Clipping
- Knowledge of C++
- Knowledge of Source Engine
- Source SDK Base 2013 - Currently tested on Source SDK Base 2013 Multiplayer.
Getting the Implementation/Code
First of all, you'll need the following files from the following GitHub repository:
Which you will copy to src/game/client/. You can also create a subfolder if you wish to, and copy these files there.
Now head over to cdll_client_int.cpp' and include
// memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h"
In the same cpp, find CHLClient::PostInit() and add this to the end:
Lastly, find void OnRenderEnd() and add this to the end:
You're all set! Compile your client project and check if it works.
If you start the game/mod with one of the following parameters:
Or if you're compiling into a different platform, else than WIN32, the cursor clipping will be disabled and won't work by default. This behavior can be changed by modifying CCursorClipManagement::Think().
You can also add a ConVar to enable or disable this dynamically in-game, all you'll need to do is adding one more check on CCursorClipManagement::Think().