TannerRogalsky / love.js

LÖVE ported to the web using Emscripten
MIT License
493 stars 53 forks source link

love.mouse.newCursor doesn't work. #18

Open Bobbyjoness opened 8 years ago

Bobbyjoness commented 8 years ago

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

TannerRogalsky commented 8 years ago

Can I have a link to these examples, please?

TannerRogalsky commented 8 years ago

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).

Bobbyjoness commented 8 years ago

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

TannerRogalsky commented 8 years ago

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

TannerRogalsky commented 8 years ago

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 commented 7 years ago

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.