Class MathClamp
- Namespace
- Fantas
- Assembly
- Fantas.dll
Contains helper methods for doing Lerp to make it easier port games from MonoGame to Fantas Some methods imported from XNA/MonoGame MathHelper https://github.com/MonoGame/MonoGame/blob/develop/MonoGame.Framework/MathHelper.cs
public static class MathClamp : Object
- Inheritance
-
MathClamp
Methods
Clamp(double, double, double)
Restricts a value to be within a specified range.
public static double Clamp(double value, double min, double max)
Parameters
valuedoubleThe value to clamp.
mindoubleThe minimum value. If
valueis less thanmin,minwill be returned.maxdoubleThe maximum value. If
valueis greater thanmax,maxwill be returned.
Returns
- double
The clamped value.
Clamp(int, int, int)
Restricts a value to be within a specified range.
public static int Clamp(int value, int min, int max)
Parameters
valueintThe value to clamp.
minintThe minimum value. If
valueis less thanmin,minwill be returned.maxintThe maximum value. If
valueis greater thanmax,maxwill be returned.
Returns
- int
The clamped value.
Clamp(float, float, float)
Restricts a value to be within a specified range.
public static float Clamp(float value, float min, float max)
Parameters
valuefloatThe value to clamp.
minfloatThe minimum value. If
valueis less thanmin,minwill be returned.maxfloatThe maximum value. If
valueis greater thanmax,maxwill be returned.
Returns
- float
The clamped value.