[Feature Request] Add "Sign" function
Posted: 14 Aug 2018, 12:53
A "Sign" function would be very useful in many cases where only a max distance of 1 is allowed which is a case I have encountered many times with directional mouse movement. Sign() would take any number and would return -1 for a negative value, 0 for a 0 value and 1 for a positive value.
Here's a sample implementation for C++:
return -1 + (int)(number > -1) + (int)(number > 0);
Here's a sample implementation for C++:
return -1 + (int)(number > -1) + (int)(number > 0);