add clamp function

This commit is contained in:
Quentin Leonetti 2019-07-13 21:35:47 +02:00
parent 0dc0db98a9
commit ca1ddbdeed

View File

@ -108,4 +108,8 @@ function Library (ronin) {
this.div = function (a, b) { this.div = function (a, b) {
return a / b return a / b
} }
this.clamp = function (val, min, max) {
return Math.min(max, Math.max(min, val))
}
} }