Closed ghost closed 8 years ago
Luxe.snow.runtime.window_grab(true);
to hide pointer and force all mouse-move events to be relative
Luxe.snow.runtime.window_grab(true);
to show it again
Note: You can open console (press ~
key) to show mouse if something goes wrong.
@ntrf Oh, thanks you again :+1:
@ntrf, but what if I want to make a custom cursor? How can i do this?
No idea. In my game (flight simulator) i have a targeting crosshair following the invisible cursor every time it moves, but it's a 3d object in scene. Maybe you can do it with SDL api (https://github.com/snowkit/linc_sdl/tree/master/sdl). That option doen't work in my game beacuse i need it to be playable with gamepad.
@ntrf, Understood. I look at this later. Thx.
@CamperPR you can use the SDL api, but keep in mind that it is cpp target specific.
sdl.SDL.showCursor(false);
sdl.SDL.showCursor(true);
For custom cursor you have to abide by the platform rules, and SDL let's you set some options but it may require a bit of effort, I haven't tried it but you basically have to take the pixels from an image asset and give them to the api as bytes data.
For web target, cursor visibility is added/removed to the css, which you can use the haxe js api's to access the game canvas by id and do anything needed from there.
I spent much time to find this:
#if web
js.Browser.document.getElementById("app").style.cursor = 'none';
#end
I want to cry...
How I can do that? Luxe.screen.cursor hasn`t field visible.