(click for web demo)
I made a small GameMaker: Studio extension that provides a unified API for "mouselock" between desktop and web (HTML5).
The way this works is by utilizing built-in mouse snapping functions on desktop targets, and using Pointer Lock API on HTML5.
It bridges between the two, and you get simple functions like mouse_lock(), mouse_unlock(), and mouse_delta_x & mouse_delta_y for getting the mouse movement offset while mouse is locked.
So, if you ever wanted to make some web-based first-person shooters (or just games with mouselook) with GameMaker: Studio, now you can.
The extension is free and can be downloaded from itch.io or
One of common questions about GameMaker: Studio include "How do I detect presses of hardware buttons (Home, Menu, Back, Search)?".
Despite of common assumptions, usage of these in GameMaker: Studio is pretty straight-forward - mentioned button events are automatically mapped to according keyboard button events. So, handling these is as easy as adding standard keyboard events.
More information about each follows,
There are multiple cases where you may want to let user input text in a familiar way, keeping things intact with system settings and allowing minor tweaks like repositioning the text cursor. Such include consoles, chatboxes, input fields, and other. This example covers these needs with fairly short (less than 70 lines total) and fairly understandable code. It includes the following features:
- Keeps track of input text on window focus loss. If you've tried to make an input box before, you may be similar with that unpleasant default behaviour of keyboard_string in GameMaker.
- Allows to reposition cursor (left / right / home / end keys)
- Allows to use Delete key to erase characters
- Can be easily modified to support other keys and shortcuts
Example includes actual input field object, and sample list drawer, to which typed text is sent upon press of Enter.
Love2d only provides you with a function to check if specific key is currently down, love.keyboard.isDown(key), and no functions to check if key was pressed\released.
But there are events, which can be used to implement such functions.
Code below demonstrates sample implementation.