Help with your scripting

getMouseDelta

getMouseDelta

Postby ant0N » 16 Aug 2014, 17:17

what is returned from this command?
If I don't move the cursor, I get the values 1 or-1. But sometimes there are other values are 7, -10 and any other number.
Isn getMouseDelta() should not return 0, if not move the cursor?
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller

Re: getMouseDelta

Postby SolarPortal » 16 Aug 2014, 19:15

to use the sky.getMouseDelta() and the new screen.getMouseDelta() is as follows:

Code: Select all
msDeltaX, msDeltaY = sky.getMouseDelta();

a quicker way of using this is:

Code: Select all
msDelta = newType.vec2(sky.getMouseDelta());

you can then use msDelta.x and msDelta.y in the code which returns an integer of the movement value.
eg. 1, 50, 100.

You can then divide the value by however much to get a usable delta. e.g.
Code: Select all
msDelta.x = msDelta.x * 0.01;
msDelta.y = msDelta.y * 0.01;


User Request: Reset delta to 0, when mouse is not used.
You will be happy to also know that we have fixed the mousedelta to return a 0 value if mouse if not moved,
when used in the update loop or anywhere outside of the onMouseMove(x,y) event.

The reason we did not have this, is due to the way we accessed the variable, which was through the onMouseMove event, not the update.
We handled all the movement from that event instead of the update to save unnecessary calls to commands when the mouse is not moved,
which ultimately saves performance.

But as with skyline, we want a system where it does what you want, and now it does :D

This will be in the next update.
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: getMouseDelta

Postby ant0N » 17 Aug 2014, 05:06

Thank you! I'll wait for the next release. :D
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller


Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 7 guests

cron