mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-26 06:56:45 +01:00
16 lines
No EOL
371 B
Text
16 lines
No EOL
371 B
Text
function value_snap_real(val, snap = 1) {
|
|
gml_pragma("forceinline")
|
|
return snap == 0? val : round(val / snap) * snap;
|
|
}
|
|
|
|
function value_snap(val, snap = 1) {
|
|
gml_pragma("forceinline")
|
|
|
|
if(!is_array(val))
|
|
return value_snap_real(val, snap);
|
|
|
|
var _val = [];
|
|
for( var i = 0, n = array_length(val); i < n; i++ )
|
|
_val[i] = value_snap(val[i], snap);
|
|
return _val;
|
|
} |