Provides mouse input outside of the game canvas.
Functions
window_mouse_x() - x coordinate of mouse relative to the canvas
window_mouse_y() - y coordinate of mouse relative to the canvas
display_mouse_x() - x coordinate of mouse on the browser
display_mouse_y() - y coordinate of mouse on the browser
Live Example
http://syntaxgames.c...amemaker/mouse/
Links
http://syntaxgames.c...mouse/Mouse.zip (direct)
http://www.crocko.co...1D5A8/Mouse.zip (mirror)
How To Use
Because GML doesn't currently work for extensions in Game Maker HTML5, I have included Mouse.gex and a Mouse.gml. The extension contains the Javascript for display_mouse functions and the GML contains the scripts for the window_mouse. Just add those to your project and you're set to go.
Compatibility
We did used to do this, but the problem is if you do capture input outside of the canvas the whole web page suffers. You can no longer scroll pages on tablets, and some input doesn't go through to the underlying page, which makes it unsuitable for using in a web environment.
This forced us to only capture "canvas" events. JavaScript and Canvas does have some nasty - and stupid - limitations. We will keep looking for an answer, but until we get one that works across the board, we're stuck with what we have.
Sorry.
License
Feel free to use and abuse as you wish. Credit goes to http://javascript.in...oordinates.html for the Javascript.
EDIT: Also, please note that when using an iframe, I don't believe an iframe can capture any mouse input outside of that frame. (Please do correct me if i'm wrong).
Edited by Schalk, 18 October 2011 - 10:11 AM.











