I hereby claim:
- I am adis on github.
- I am adis (https://keybase.io/adis) on keybase.
- I have a public key whose fingerprint is 7071 A5B9 8F33 DD7C 8B2F B9E4 72F4 477B E57E 00A8
To claim this, I am signing this object:
// Crosshair | |
cl_crosshair_drawoutline “0” | |
cl_crosshairalpha “250” | |
cl_crosshaircolor “1” | |
cl_crosshairdot “0” | |
cl_crosshairgap “-2” | |
cl_crosshairgap_useweaponvalue “0” | |
cl_crosshairsize “2” | |
cl_crosshairstyle “4” | |
cl_crosshairthickness “0” |
// offset can be any countable type | |
let newAlpha = offset.clamped(to: 0.0 … 1.0) |
// https://developer.apple.com/documentation/swift/comparable | |
extension Comparable { | |
func clamped(to limits: ClosedRange<Self>) -> Self { | |
return min(max(self, limits.lowerBound), limits.upperBound) | |
} | |
} | |
// https://developer.apple.com/documentation/swift/strideable | |
extension Strideable where Stride: SignedInteger { | |
func clamped(to limits: CountableClosedRange<Self>) -> Self { |
func clamp(offset: Float) -> Float { | |
return max(min_offset, min(max_offset, offset)) | |
} |
func clamp(offset: Float) -> Float { | |
if offset < min_offset { | |
return min_offset | |
} else if offset > max_offset { | |
return max_offset | |
} else { | |
return offset | |
} | |
} |
I hereby claim:
To claim this, I am signing this object: