AREA Community - The Largest CG Forum on the Web
Stingray Forum
Welcome to Autodesk’s Stingray Forums. Share your knowledge, ask questions, and explore popular Stingray topics.

Stingray Forum

Reply
Post 1 of 9

show mouse icon

283 Views, 8 Replies
09-04-2015 12:15 AM

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
Post 2 of 9

Re: show mouse icon

09-04-2015 12:36 AM 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
Post 3 of 9

Re: show mouse icon

09-04-2015 12:42 AM 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

Post 4 of 9

Re: show mouse icon

09-04-2015 12:43 AM in reply to: kingnguyen

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

Post 5 of 9

Re: show mouse icon

09-04-2015 12:53 AM 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

Post 6 of 9

Re: show mouse icon

09-04-2015 01:48 AM 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

Post 7 of 9

Re: show mouse icon

09-04-2015 02:16 AM in reply to: kainevg

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

Post 8 of 9

Re: show mouse icon

09-04-2015 03:30 AM 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.

Post 9 of 9

Re: show mouse icon

09-04-2015 05:09 AM 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post