GameMaker Studio 2 (2.3)
Icon

Native Mouse Lock

YellowAfterlife

You must be logged in to obtain assets

Description

Versions: GameMaker Studio 2.3+
Platforms: Windows [x86, x64], Windows (YYC) [x86, x64]
Links: itch.io page (demo, pre-2.3 versions)

Native mouselock for GameMaker. Perfect for games with screen-space mouse aiming - no more need to worry about the game not restricting the mouse position quickly enough and user clicking outside the window - with this extension the mouse cannot escape the specified region, as it uses OS-level functionality to confine it.

Included functions:

  • display_mouse_lock(x, y, width, height)
  • display_mouse_unlock()
  • display_mouse_bounds() : Returns the current mouse bounds as an array.

Package contents:

  • The extension itself.
  • C++ source code.

Sample code:

// to be placed in Step event
if (window_has_focus()) {
    display_mouse_lock(window_get_x(), window_get_y(), window_get_width(), window_get_height());
} else display_mouse_unlock();

End User Licence Agreement (EULA).

Age Rating: 4+

Version

GMS2.3 - Version 1.0.1. Published May 23, 2021

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait