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(
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.
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
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 , 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()
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!
No problem, thanks for the support!
Read the readme for DefOS. Since Native Extensions aren’t supported on all platforms yet , it “Currently uses FFI for Windows and Native Extension for macOS”. On windows you just want to require
the “defos” lua module.