when run stingray project, it will turn off the mouse icon
We would like to turn it on but it doesn't work
function Project.on_init_complete() stingray.Window.show_cursor(true) print("INIT COMPLETE") end
I try with this code, it still doesn't work :
function Project.start() if stingray.Window then stingray.Window.set_show_cursor(true) print ("START") end end function Project.on_level_load_pre_flow() Project.start() end
Hey mate!
Add these three lines to your level_load function in the project.lua script as below and that should work 🙂
function Project.on_level_load_pre_flow() stingray.Window.set_mouse_focus(true) stingray.Window.set_clip_cursor(true) stingray.Window.set_show_cursor(true) end
Let me know how it goes 🙂
Cheers,
Kaine
Hi Kaine,
By the way, how to bring mouse cursor outside Stingray Run Project ?
I try with this code but it doesn't work
stingray.Window.set_clip_cursor(false)
Thanks.
Deviros
On my project it works for both build and test. Which template are you using?
I had the same issue when setting clip_cursor propert to false in the level_load_pre_flow() function, however, I put it in the update function which then allowed me to move it outside the window. Obviously you don't actually want it being called every frame, but it suggests that the clip_cursor property is being set sometime after that level_load function. You'd need to write a function that is called later in the startup process.
Cheers,
Kaine
That's bizarre. I tested it on basic which worked. You might have to wait for one of the Autodesk guys to respond as it should work..though at least it will actually run in the proper build. As a work-around if you have multiple levels you can just change what the default level is so you can build instead of test.
Just a quick update.. was looking around in the Appkit, and I figured out how to make it so you can get the cursor to not be constrained to the window without trying to call the function at a later time..
In your project.lua file, under the SimpleProject.config ={} table, add this line:
dont_capture_mouse_at_startup = true
Make sure when you add it, you have a comma between it and the line above it. Then all you need it this:
function Project.on_level_load_pre_flow() stingray.Window.set_show_cursor(true) end
and voila, you should now see the cursor, and be able to move it outside the window.
Cheers,
Kaine
Can't find what you're looking for? Ask the community or share your knowledge.