love.js icon indicating copy to clipboard operation
love.js copied to clipboard

love.mouse.newCursor doesn't work.

Open Bobbyjoness opened this issue 9 years ago • 6 comments

I ran the examples.love in the browser and it works perfectly only issue is setting the cursor position and image does not work.

Bobbyjoness avatar Feb 13 '16 18:02 Bobbyjoness

Can I have a link to these examples, please?

TannerRogalsky avatar Feb 13 '16 19:02 TannerRogalsky

But, ultimately, there's no mechanism for moving a mouse from JavaScript so that will never work unless browsers start exposing that functionality (and they probably never will because you really don't want a site to be able to move your mouse around and make you click stuff).

TannerRogalsky avatar Feb 13 '16 19:02 TannerRogalsky

https://github.com/love2d-community/LOVE-Example-Browser

Bobbyjoness avatar Feb 13 '16 19:02 Bobbyjoness

love.mouse.newCursor seems like it should work, though. Maybe it's just not implemented in emscripten's SDL stuff.

TannerRogalsky avatar Feb 13 '16 20:02 TannerRogalsky

https://github.com/emscripten-ports/SDL2/blob/master/src/video/emscripten/SDL_emscriptenmouse.c#L61

Turns out the Emscripten part of SDL just discards the surface that gets passed to it. I wonder if it would be possible to encode the surface data into base64 and use that as a data url for the CSS to change the cursor.

TannerRogalsky avatar Mar 18 '16 15:03 TannerRogalsky

This actually got implemented in the emscripten ports version of SDL2. https://github.com/emscripten-ports/SDL2/pull/39

But since we're using megasource's copy of SDL2 now, I'm not sure the best way to get this into love.js. Either have to copy that change over to SDL2's main repo or patch Love's copy. Maybe @slime73 has an opinion on the best approach to this.

TannerRogalsky avatar May 30 '17 22:05 TannerRogalsky