Stingray Forum (Read Only)
Welcome to Autodesk’s Stingray Forums. Share your knowledge, ask questions, and explore popular Stingray topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

show mouse icon

8 REPLIES 8
Reply
Message 1 of 9
kingnguyen
1264 Views, 8 Replies

show mouse icon

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
8 REPLIES 8
Message 2 of 9
devirosnguyen
in reply to: kingnguyen

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
Message 3 of 9
kainevg
in reply to: devirosnguyen

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

Message 4 of 9
devirosnguyen
in reply to: kingnguyen

It only show on Build, how to show it on Test?

Message 5 of 9
devirosnguyen
in reply to: kainevg

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

Message 6 of 9
kainevg
in reply to: devirosnguyen

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

Message 7 of 9
kingnguyen
in reply to: kainevg

I use basic template, and just see mouse cursor in build only

Message 8 of 9
kainevg
in reply to: kingnguyen

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.

Message 9 of 9
kainevg
in reply to: kainevg

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.

Post to forums  

Autodesk Design & Make Report