How to show mouse cursor in fullscreen? (SOLVED)

Hi, any tutorials for how to show the mouse cursor in full screen? (using windows 7/10) thanks

1 Like

Hi!

Unfortunately you will have to use DefOS for that (but if you are developing for desktop it is almost mandatory anyway).

defos.set_cursor_visible(bool_value)
bool_value = defos.is_cursor_visible()
4 Likes

I set the dependency, and put that code into init function in some script, but doesnt work.

I put this

function init(self)
	defos.set_cursor_visible(true)
end

The function requires a boolean value, either true or false. The error message said that you are sending in a nil. Nil is “Nothing” in other languages it is also called None, null, NaN and so on.

This can happen in lua if you don’t set a variable in lua. You need to set the variable bool_value before using it.

local bool_value = true
defos.set_cursor_visible(bool_value)

Of course you can simply pass it in directly too

defos.set_cursor_visible(true)

yes I did that, but continues no working

edit:

I put this

print(defos.is_cursor_visible())

and return me true, but cursor is not showing

It is late and I just realized that the cursor should always be visible if not turned off…
So are you saying that you can’t see a cursor when building your game with ctrl+b?

Have you edited your cursor in Windows somehow? Defold should use your hardware cursor by default.

no I dont edit nothing. its strange, because the funtion gets true…

I create a gif showing you, @Mattias_Hedberg
GIF

1 Like

I have to admit, I didn’t even know Defold had that checkbox. Checking it and the cursor disappears for me too. :thinking:

Maybe the Devs know why. But in the meanwhile you can toggle fullscreen with defos defos.toggle_fullscreen() and uncheck the box in the game.project.

1 Like

well in the gif, the programm doenst capture the cursor too…
@Mattias_Hedberg thanks, unckecking fullscreen works. Thanks for the fast help

2 Likes