Mouse has no limits in fullscreen mode on Windows 7 and 10

Steps to reproduce:
0. Create project

  1. Set fullscreen mode in game.properties
  2. Add
    print(action.screen_x, action.screen_y)
    to on_input function
  3. Build and move mouse to any direction
    Expectations: 0 <= coordinates <= resolution
    Reality (for example): (-170, -19932)
1 Like

I can think of a few use cases where you might want to be able to drag mouse off the screen edge so it would be bad to remove it altogether. It’s also easy to clamp the values yourself.

So, do we agree that this is by design? I agree that for some use cases it is useful, but in the case where you wish to clamp the values and use a virtual mouse pointer it becomes cumbersome since you cannot use the raw values but instead have to manually keep track of a mouse pointer position and use delta values for movement.

How does other engines do the same thing? And if this is the case then maybe we need to add a note about it in the input documentation?

It is better to be able to manually set system mouse cursor position then devs can handle it ourselves. I think the glfw2 function is glfwSetMousePos(x, y) for doing native code. Someone could test it with native extensions?

Most of the time with games you want to lock the cursor to the game’s window, or the window of the active monitor the game is running on.

The problem of those few use cases is that them will be available only in fullscreen and not available in window mode. The behaviors are different. Developer still have to make his own crutch for one of these mode.

It’s not only in fullscreen. You do get screen coordinates outside windowed games as well.

Hm… I can’t get coordinates (-100500, -100500) for windowed games.

Well, there are 3 main “types” of mouse movement i can think of:

  1. “FPS-style” where the mouse is locked in the middle of the screen, and we can only get deltas on each frame. If the mouse is unlocked user will be accidentally clicking on other apps (fullscreen still takes only 1 monitor, and user can have more).
  2. Clamped to game window. Should work the same way whether the game is windowed, borderless or fullscreen (and even if the game takes only 1 of 2 connected monitors)
  3. Clamped to the total screen size.
    Last two modes might be with or without mouse being visible, depending on the game.
    And well, mouse is forced to be invisible in fullscreen (if im correct) and we can’t change it anyway, mouse can be moved infinitely in fullscreen, and windowed/fullscreen mode can be only set up before building the game. ¯\_(ツ)_/¯
    Not like these settings are critical (we were discussing it a while ago), but i dunno abouth full-free mouse mode where we can get (-9k,-9k) coordinates for the mouse in fullscreen mode.