Hiding the mouse cursor (DEF-1619)

I can vouch for this. The cursor is often a big part of a game’s aesthetic, and I’m sure a lot of us would appreciate an easy way to change or hide it.

7 Likes

I want custom cursor. Is there any changes for this issue?

1 Like

Both of these, setting custom hardware cursor, hiding mouse cursor, may be possible now with Lua C Packages although I have not tested it personally. I believe it’s GLFW 2 still so you can just call their functions maybe. Someone with time and motivation could try getting it to work.

Can anyone say the exact version number of GLFW 2 Defold is using?

https://www.lua.org/pil/8.2.html

May need to use a resource editor to add an extra cursor icon to your exe for Windows for example.

This is on my big list of todos but I won’t have free time in the near future for this to look into it.

1 Like

Just another vote for being able to hide the mouse cursor.

This would also have the side effect of allowing us to create custom cursors (by hiding the existing cursor and showing any sprite we want at the mouse location on update() ).

8 Likes

Hiding the hardware cursor is still not possible?

My guess is that this will be possible in just a few weeks when we have added full native extension support on all platforms. Someone with more Windows, OSX and Linux support than me can probably tell which APIs that need to be called on the respective platforms.

There’s a way to do it on Windows posted here now. Doing it on other OSes is a similar process probably but people on each should test.

1 Like

any more updates on if this is possible??

You can hide your cursor using DefOs DefOS - Extra native OS functions
And then add your own cursor in on_input method

2 Likes

I’m almost inclined to say that this issue should be closed. Yes, nice to have it in the engine, but if it’s readily available in an extension then it’s unlikely that we’ll give an engine integrated solution priority.

I’ll try to make example project and upload to github.

I’m still of the opinion that all features of DefOS has should be core Defold eventually.

1 Like

simple example
Custom Cursor Example.zip (2.2 MB)

I disagree with you.
As I told earlier modules with special functionality this is good architecture in my opinion. Better than huge engine with million api methods, and games which use only 1% of them.

I hope in future all exernal dependencies and appmanifest modules would be connect to the project by checkboxes (config with all modules can be generated and downloaded from the community page, for example).

3 Likes

Modularity is good and the appmanifest features are very good. I still think these features belong in core Defold and maintained by Defold team because they are universally important for shipping commercial games, maybe as an OS module which still be enabled or disabled with an appmanifest option.

1 Like

I agree with both of you. :slight_smile:

It’s great that DefOS is a module that you only add in if you need it. Plus, mobile and web projects especially need to keep the size down.

But . . .

To be honest I don’t like ^ this ^ very much (no offense, Britzl). The things that DefOS does (and more) are pretty much essential for any desktop project. The current built-in desktop support is so limited, I really don’t think it’s possible to make a desktop game without an extension—at least not a polished and professional one.

This could be a long discussion, but anyway, I still hope for full, official support for desktop. Defold would be ideal for desktop games, if only it had these features! People won’t choose an engine unless it already provides the things they need. (like this guy)

4 Likes

after years of this topic, what is the easy way to hide mouse cursor now?!

I have downloaded this example, i still see mouse cursor in game(windows 10)
edit:
i have one error:
ERROR:GAMESYS: Error running Window callback: /main/cursor.script:5: attempt to call field ‘enable_mouse_cursor’ (a nil value)

You should add DefOS.
Also its api has changed.

defos.set_cursor_visible(bool_value)
4 Likes

Thanks selimanac, does it workson html5 too?

I don’t know, I didn’t try it with DefOS.
You can simple hide cursor by using css+js on html page for canvas without defos. But hiding cursor on html canvas pretty weird to me.

1 Like