Files
LuaCsForBarotraumaEP/Barotrauma/BarotraumaClient/Source/GUI/GUIMessage.cs
T
juanjp600 7a413aee93 Optimized GameScreen.DrawMap
- Downscaled lightmap, since blurring will make this unnoticeable anyway
(TODO: make this optional)
- Render LOS in fewer passes by using a shader
- Use light volume to calculate LOS
- This also means we can use the override texture to render the diving
suit obstruct effect
- Don't render bunks and labels onto LOS background (TODO: add the
option to render back into the LOS background, i.e. just use
multiplicative blending as if it was the lightmap)
- Prefer SpriteSortMode.Deferred over all others, prefer
SamplerState.LinearClamp/PointClamp over all others
- Remove shader blur in favor of geometry blur (TODO: improve on this
further, right now it has a few artifacts)
- Trim light volumes
- Do some weird shit with the background particles (use DrawTiled
instead of relying on SamplerState.LinearWrap, because that's faster
somehow :/ )
- Pressing up/down in the console only returns a typed command now
2017-12-20 19:41:23 -03:00

81 lines
1.8 KiB
C#

using Microsoft.Xna.Framework;
namespace Barotrauma
{
class GUIMessage
{
private ColoredText coloredText;
private Vector2 pos;
private float lifeTime;
private Vector2 size;
public string Text
{
get { return coloredText.Text; }
}
public Color Color
{
get { return coloredText.Color; }
}
public Vector2 Pos
{
get { return pos; }
set { pos = value; }
}
public Vector2 Size
{
get { return size; }
}
public Vector2 Origin;
public float LifeTime
{
get { return lifeTime; }
set { lifeTime = value; }
}
public Alignment Alignment
{
get;
private set;
}
public bool Centered;
public GUIMessage(string text, Color color, Vector2 position, float lifeTime, Alignment textAlignment, bool centered)
{
coloredText = new ColoredText(text, color, false);
pos = position;
this.lifeTime = lifeTime;
this.Alignment = textAlignment;
if (textAlignment.HasFlag(Alignment.Left))
Origin.X += size.X * 0.5f;
if (textAlignment.HasFlag(Alignment.Right))
Origin.X -= size.X * 0.5f;
if (textAlignment.HasFlag(Alignment.Top))
Origin.Y += size.Y * 0.5f;
if (textAlignment.HasFlag(Alignment.Bottom))
Origin.Y -= size.Y * 0.5f;
if (centered)
{
Origin = new Vector2((int)(0.5f * size.X), (int)(0.5f * size.Y));
}
else
{
size = GUI.Font.MeasureString(text);
}
}
}
}