This extension lets you handle HTML5 paste events in GameMaker games compiled for HTML5.

Can be called as following:

  • browser_paste_bind(handler_script)
    Binds a paste event handler.
    If an image/other file-like thing is pasted, handler_script is called with arguments like ("data:image/png;base64,...", "image.png", "image/png"). 
    If text is pasted, handler_script is called with arguments like ("some text", undefined, "text/plain") [name == undefined].
  • browser_paste_bind(handler_script, filter_script)
    Same as above, but lets you specify a filter script. A filter script receives pasted item kind ("string"/"file") and pasted item mimetype ("text/plain", "image/png", etc.) and returns whether you want to process it or not.
  • browser_paste_bind()
    Unbinds the paste event handler.

For pasting images, best used with Allow Data URI.
Can be imported into GMS2.

Have fun!

Published 29 days ago
StatusReleased
CategoryAssets
AuthorYellowAfterlife
Made withGameMaker: Studio
TagsGameMaker

Download

Download NowName your own price

Click download now to get access to the following files:

browser_paste.gmez 1 kB
browser_paste.gmz 25 kB

Comments

Log in with itch.io to leave a comment.

It's not working for me, I'm using Mac and tested in Safari, Firefox and Chrome.

Have you clicked the game embed to give it focus first?

Just tried in Chrome on MacOs Mojave.. gave focus to frame.. no go.. 

Try now, should be fixed (had to explicitly make GM not consume the Cmd+V keyboard shortcut)

works for me now.