How to change the mouse cursor


#1

Hello,

I’ve just started using heaps.io and haxe and so far it has been great. There is a pleasant balance between providing useful frameworks without requiring a more GUI driven approach.

However I have hit a problem … basically I want to turn off the cursor (hide) which I am doing with

hxd.System.setCursor(Hide);

This works great until I start using h2d.Interactive which changes the cursor when I go over the object. Fair enough and easily fixed with a

var interactive = new h2d.Interactive(100, 100, parent);
interactive.cursor = Hide;

Unfortunately when I leave the Interactive it reverts back to the default cursor so my cursor reappears (ie doesn’t stay hidden).

I’ve tried setting it to Hide again in the onOut of the Interactive however I believe this is called before the cursor is then set to Default (ie doesn’t work).

Some hunting around the code makes me believe this is because the SceneEvents is using the defaultCursor variable to reset it.

I can get at the SceneEvents via myApp.sevents but it doesn’t expose the defaultCursor.

In theory I can work around by skipping the h2d.Interactive and using

hxd.Window.getInstance().addEventTarget(onEvent);

or

var scene: h2d.Scene = getScene();
if (scene != null) {
scene.addEventListener(this);
}

or something with InterativeScene’s

or just potentially hack the SceneEvents

However all of this feels like I’m reinventing Interactive or hacking.

Any pointers in the right direction would be much appreciated.

Thanks