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
- Inheritance
-
MathClamp
- Inherited Members
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
value
doubleThe value to clamp.
min
doubleThe minimum value. If
value
is less thanmin
,min
will be returned.max
doubleThe maximum value. If
value
is greater thanmax
,max
will 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
value
intThe value to clamp.
min
intThe minimum value. If
value
is less thanmin
,min
will be returned.max
intThe maximum value. If
value
is greater thanmax
,max
will 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
value
floatThe value to clamp.
min
floatThe minimum value. If
value
is less thanmin
,min
will be returned.max
floatThe maximum value. If
value
is greater thanmax
,max
will be returned.
Returns
- float
The clamped value.