Posts

Showing posts from June, 2016

Tracking your mouse in games and editors

It is quite common to hide your mouse while the game is on the game window. Another common technique is restricting the mouse movement somehow inside the game window. Both of those techniques help with getting rid of the cursor while the player is playing the game Where is my mouse? It must be one of the most common issues in games/emulators/whatnot. The player needs to minimize the window to take care of some other task on her computer but the mouse remains hidden and/or trapped within an invisible rectangle, preventing the user to complete her action or even see what she is doing. This is a very frustrating problem and surprisingly, a lot of games get this wrong. Before I saw this problem in code, I assumed that this issue is taken care of automagically, however this is not the case. Let's consider the ShowCursor windows API function for a moment: Internally, the system is a reference counter: Each call of the function with a True argument will increase the counter and