38f1ddb...178a853: v0.8.9.1, removed content folder
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -91,6 +92,24 @@ namespace Barotrauma
|
||||
return q1;
|
||||
}
|
||||
|
||||
public static Color Add(this Color sourceColor, Color color)
|
||||
{
|
||||
return new Color(
|
||||
sourceColor.R + color.R,
|
||||
sourceColor.G + color.G,
|
||||
sourceColor.B + color.B,
|
||||
sourceColor.A + color.A);
|
||||
}
|
||||
|
||||
public static Color Subtract(this Color sourceColor, Color color)
|
||||
{
|
||||
return new Color(
|
||||
sourceColor.R - color.R,
|
||||
sourceColor.G - color.G,
|
||||
sourceColor.B - color.B,
|
||||
sourceColor.A - color.A);
|
||||
}
|
||||
|
||||
public static string LimitString(string str, ScalableFont font, int maxWidth)
|
||||
{
|
||||
if (maxWidth <= 0 || string.IsNullOrWhiteSpace(str)) return "";
|
||||
@@ -108,6 +127,16 @@ namespace Barotrauma
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
public static Color GradientLerp(float t, params Color[] gradient)
|
||||
{
|
||||
if (t <= 0.0f) return gradient[0];
|
||||
if (t >= 1.0f) return gradient[gradient.Length - 1];
|
||||
|
||||
float scaledT = t * (gradient.Length - 1);
|
||||
|
||||
return Color.Lerp(gradient[(int)scaledT], gradient[(int)Math.Min(scaledT + 1, gradient.Length - 1)], (scaledT - (int)scaledT));
|
||||
}
|
||||
|
||||
public static string WrapText(string text, float lineLength, ScalableFont font, float textScale = 1.0f) //TODO: could integrate this into the ScalableFont class directly
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user