Show Cursor in FullScreen Mode? (DEF-1619)

Hi, I see topics on the forum asking how to hide the cursor (i.e DEF-1619 ), but I can’t find any information on the opposite.
In project Settings when I enable the “fullscreen” option and launch my game there is no visible cursor on the screen.

Is there any way of enabling the cursor while in full-screen mode?
I feel like I’m missing something because the only other threads I see ask about hiding it.

The game I’m currently working on is a click based game, so it’s highly dependant on having a cursor.

Thanks.

2 Likes

What OS are you testing on?

I have got the same problem, windows 8.1 64bit. I did everything that i can find with google but nothing helps(

@sven, do you know anything about the cursor not showing in fullscreen mode?

I also cheked this on 2 notebooks, same.

Well, we’re using GLFW 2.7 as a foundation, and there they simply disable the cursor when creating the window and, at the same time, entering full screen:

    // If full-screen mode was requested, disable mouse cursor
    if( mode == GLFW_FULLSCREEN )
    {
        glfwDisable( GLFW_MOUSE_CURSOR );
    }

We will look into this as soon as we get to DEF-1619, but I cannot currently give you a delivery date. But I’ll be sure to discuss this with the team on monday.

2 Likes

I can also confirm this happens to me on macOS 10.12.2

So, I managed to hack up a workaround based on your code. Getting FFI to work was a bit tricky since require("ffi") doesn’t work, but I got it.

if jit then
    local ffi = package.preload.ffi()
    ffi.cdef[[
    void glfwEnable(int token);
    ]]
    ffi.C.glfwEnable(0x00030001) --GLFW_MOUSE_CURSOR
end
4 Likes

What exactly i need to do with this code? Thank you.

What OS are you on? This works for me on OSX but not on Windows. Looks like Defold team would need to fix to make it possible to work on Windows too? http://stackoverflow.com/questions/5919743/how-to-use-luajits-ffi-module-when-embedding

On Windows
ERROR:SCRIPT: main/main.script:11: cannot resolve symbol 'glfwEnable': The specified procedure could not be found.

Run it in init().

Oh. That’s too bad. I’m on OS X. I guess we have to wait for a fix on Windows.

UPDATE: I tried to call the Win32 API directly and managed to show the cursor, but unfortunately it’s locked in the middle of the screen by glfw code and unless somebody knows how to defeat ASLR from Lua :laughing: , I can’t disable that.

Paste code for how far you got?

We should probably wait until external code is properly allowed. Doing things this way is dodgy!

I was calling

ReleaseCapture();
ClipCursor(NULL);
ShowCursor(TRUE);

but in glfw code, a lot of code also depends on glfwWin.mouseLock, which I can’t unset and, as a result the mouse is prevented from moving each frame.

But yes, I agree this is dodgy and we should wait.

any update on this problem?

I’m guessing that this is solved thanks to DefOS?

defos.toggle_fullscreen()
defos.enable_mouse_cursor()
2 Likes

I afraid that is not help on mac if developer set a fullscreen checkbox in project settings (I am using NSwindow methods. In engine it looks likes fullscreen set by other way, i try to understand how)

But yes, if user do not use fullscreen option in project settings - it help.

mmm, I get this error when trying the defos library:

build server output: unsupported platform x86_64-windows

That’s unfortunately because we don’t support native extensions on windows quite yet! We’re working on it, and hope to deliver support for it soon!

1 Like

No problem, thanks for the support!