Server list, lighting/los optimization

This commit is contained in:
Regalis
2015-08-07 23:10:12 +03:00
parent 08c5117e8f
commit 0937c30f15
45 changed files with 36611 additions and 41 deletions
+24
View File
@@ -9,6 +9,8 @@ namespace Subsurface
{
abstract class GUIComponent
{
const float FlashDuration = 1.5f;
public static GUIComponent MouseOn;
protected static KeyboardDispatcher keyboardDispatcher;
@@ -36,6 +38,8 @@ namespace Subsurface
protected ComponentState state;
protected float flashTimer;
public virtual SpriteFont Font
{
get;
@@ -200,12 +204,30 @@ namespace Subsurface
return false;
}
public void Flash()
{
flashTimer = FlashDuration;
foreach (GUIComponent child in children)
{
child.Flash();
}
}
public virtual void Draw(SpriteBatch spriteBatch)
{
Color currColor = color;
if (state == ComponentState.Selected) currColor = selectedColor;
if (state == ComponentState.Hover) currColor = hoverColor;
if (flashTimer>0.0f)
{
Color flashColor = Color.Red * (flashTimer / FlashDuration)*0.8f;
GUI.DrawRectangle(spriteBatch,
new Rectangle(rect.X-5,rect.Y-5,rect.Width+10,rect.Height+10), flashColor, true);
}
GUI.DrawRectangle(spriteBatch, rect, currColor * (currColor.A / 255.0f), true);
if (sprites != null)
@@ -246,6 +268,8 @@ namespace Subsurface
public virtual void Update(float deltaTime)
{
if (flashTimer>0.0f) flashTimer -= deltaTime;
if (CanBeFocused)
{
if (rect.Contains(PlayerInput.MousePosition))
+3
View File
@@ -152,6 +152,7 @@ namespace Subsurface
MouseState previousMouse;
public override void Update(float deltaTime)
{
if (flashTimer > 0.0f) flashTimer -= deltaTime;
if (!Enabled) return;
caretTimer += deltaTime;
@@ -178,6 +179,8 @@ namespace Subsurface
}
}
textBlock.Update(deltaTime);
}
public override void Draw(SpriteBatch spriteBatch)