/// <summary>Renders the ATS lamp overlay</summary> /// <param name="Element">The HUD element these are to be rendererd onto</param> /// <param name="TimeElapsed">The time elapsed</param> private void RenderATSLamps(HUD.Element Element, double TimeElapsed) { if (TrainManager.PlayerTrain == null) { return; } // ats lamps if (CurrentLampCollection == null) { CurrentLampCollection = new LampCollection(TrainManager.PlayerTrain); } double lcrh, lw, rw; CalculateViewingPlaneSize(Element, out lw, out rw, out lcrh); // start // ReSharper disable once PossibleNullReferenceException int n = CurrentLampCollection.Lamps.Length; double w = CurrentLampCollection.Width + lw + rw; double h = Element.Value2 * n; double x = Element.Alignment.X < 0 ? 0.0 : Element.Alignment.X > 0 ? renderer.Screen.Width - w : 0.5 * (renderer.Screen.Width - w); double y = Element.Alignment.Y < 0 ? 0.0 : Element.Alignment.Y > 0 ? renderer.Screen.Height - h : 0.5 * (renderer.Screen.Height - h); x += Element.Position.X; y += Element.Position.Y; for (int j = 0; j < n; j++) { if (CurrentLampCollection.Lamps[j].Type != LampType.None) { int o; if (j == 0) { o = -1; } else if (CurrentLampCollection.Lamps[j - 1].Type == LampType.None) { o = -1; } else if (j < n - 1 && CurrentLampCollection.Lamps[j + 1].Type == LampType.None) { o = 1; } else if (j == n - 1) { o = 1; } else { o = 0; } HUD.Image Left = o < 0 ? Element.TopLeft : o == 0 ? Element.CenterLeft : Element.BottomLeft; HUD.Image Middle = o < 0 ? Element.TopMiddle : o == 0 ? Element.CenterMiddle : Element.BottomMiddle; HUD.Image Right = o < 0 ? Element.TopRight : o == 0 ? Element.CenterRight : Element.BottomRight; MessageColor sc = MessageColor.Gray; if (TrainManager.PlayerTrain.Plugin.Panel.Length >= 272) { switch (CurrentLampCollection.Lamps[j].Type) { case LampType.Ats: if (TrainManager.PlayerTrain.Plugin.Panel[256] != 0) { sc = MessageColor.Orange; } break; case LampType.AtsOperation: if (TrainManager.PlayerTrain.Plugin.Panel[258] != 0) { sc = MessageColor.Red; } break; case LampType.AtsPPower: if (TrainManager.PlayerTrain.Plugin.Panel[259] != 0) { sc = MessageColor.Green; } break; case LampType.AtsPPattern: if (TrainManager.PlayerTrain.Plugin.Panel[260] != 0) { sc = MessageColor.Orange; } break; case LampType.AtsPBrakeOverride: if (TrainManager.PlayerTrain.Plugin.Panel[261] != 0) { sc = MessageColor.Orange; } break; case LampType.AtsPBrakeOperation: if (TrainManager.PlayerTrain.Plugin.Panel[262] != 0) { sc = MessageColor.Orange; } break; case LampType.AtsP: if (TrainManager.PlayerTrain.Plugin.Panel[263] != 0) { sc = MessageColor.Green; } break; case LampType.AtsPFailure: if (TrainManager.PlayerTrain.Plugin.Panel[264] != 0) { sc = MessageColor.Red; } break; case LampType.Atc: if (TrainManager.PlayerTrain.Plugin.Panel[265] != 0) { sc = MessageColor.Orange; } break; case LampType.AtcPower: if (TrainManager.PlayerTrain.Plugin.Panel[266] != 0) { sc = MessageColor.Orange; } break; case LampType.AtcUse: if (TrainManager.PlayerTrain.Plugin.Panel[267] != 0) { sc = MessageColor.Orange; } break; case LampType.AtcEmergency: if (TrainManager.PlayerTrain.Plugin.Panel[268] != 0) { sc = MessageColor.Red; } break; case LampType.Eb: if (TrainManager.PlayerTrain.Plugin.Panel[270] != 0) { sc = MessageColor.Green; } break; case LampType.ConstSpeed: if (TrainManager.PlayerTrain.Plugin.Panel[269] != 0) { sc = MessageColor.Orange; } break; } } // colors Color128 bc = Element.BackgroundColor.CreateBackColor(sc, 1.0f); Color128 tc = Element.TextColor.CreateTextColor(sc, 1.0f); Color128 oc = Element.OverlayColor.CreateBackColor(sc, 1.0f); // left background if (Left.BackgroundTexture != null) { if (Program.CurrentHost.LoadTexture(ref Left.BackgroundTexture, OpenGlTextureWrapMode.ClampClamp)) { double u = Left.BackgroundTexture.Width; double v = Left.BackgroundTexture.Height; renderer.Rectangle.Draw(Left.BackgroundTexture, new Vector2(x, y), new Vector2(u, v), bc); } } // right background if (Right.BackgroundTexture != null) { if (Program.CurrentHost.LoadTexture(ref Right.BackgroundTexture, OpenGlTextureWrapMode.ClampClamp)) { double u = Right.BackgroundTexture.Width; double v = Right.BackgroundTexture.Height; renderer.Rectangle.Draw(Right.BackgroundTexture, new Vector2(x + w - u, y), new Vector2(u, v), bc); } } // middle background if (Middle.BackgroundTexture != null) { if (Program.CurrentHost.LoadTexture(ref Middle.BackgroundTexture, OpenGlTextureWrapMode.ClampClamp)) { double v = Middle.BackgroundTexture.Height; renderer.Rectangle.Draw(Middle.BackgroundTexture, new Vector2(x + lw, y), new Vector2(w - lw - rw, v), bc); } } { // text string t = CurrentLampCollection.Lamps[j].Text; double u = CurrentLampCollection.Lamps[j].Width; double v = CurrentLampCollection.Lamps[j].Height; double p = Math.Round(Element.TextAlignment.X < 0 ? x : Element.TextAlignment.X > 0 ? x + w - u : x + 0.5 * (w - u)); double q = Math.Round(Element.TextAlignment.Y < 0 ? y : Element.TextAlignment.Y > 0 ? y + lcrh - v : y + 0.5 * (lcrh - v)); p += Element.TextPosition.X; q += Element.TextPosition.Y; renderer.OpenGlString.Draw(Element.Font, t, new Vector2(p, q), TextAlignment.TopLeft, tc, Element.TextShadow); } // left overlay if (Left.OverlayTexture != null) { if (Program.CurrentHost.LoadTexture(ref Left.OverlayTexture, OpenGlTextureWrapMode.ClampClamp)) { double u = Left.OverlayTexture.Width; double v = Left.OverlayTexture.Height; renderer.Rectangle.Draw(Left.OverlayTexture, new Vector2(x, y), new Vector2(u, v), oc); } } // right overlay if (Right.OverlayTexture != null) { if (Program.CurrentHost.LoadTexture(ref Right.OverlayTexture, OpenGlTextureWrapMode.ClampClamp)) { double u = Right.OverlayTexture.Width; double v = Right.OverlayTexture.Height; renderer.Rectangle.Draw(Right.OverlayTexture, new Vector2(x + w - u, y), new Vector2(u, v), oc); } } // middle overlay if (Middle.OverlayTexture != null) { if (Program.CurrentHost.LoadTexture(ref Middle.OverlayTexture, OpenGlTextureWrapMode.ClampClamp)) { double v = Middle.OverlayTexture.Height; renderer.Rectangle.Draw(Middle.OverlayTexture, new Vector2(x + lw, y), new Vector2(w - lw - rw, v), oc); } } } y += Element.Value2; } }
/// <summary>Renders the list of score messages</summary> /// <param name="Element">The HUD element these are to be rendererd onto</param> /// <param name="TimeElapsed">The time elapsed</param> private void RenderScoreMessages(HUD.Element Element, double TimeElapsed) { // score messages int n = Game.ScoreMessages.Length; float totalwidth = 16.0f; float[] widths = new float[n]; float[] heights = new float[n]; for (int j = 0; j < n; j++) { Size size = Element.Font.MeasureString(Game.ScoreMessages[j].Text); widths[j] = size.Width; heights[j] = size.Height; float a = widths[j] - j * Element.Value1; if (a > totalwidth) { totalwidth = a; } } Game.ScoreMessagesRendererSize.X += 16.0 * TimeElapsed * (totalwidth - Game.ScoreMessagesRendererSize.X); totalwidth = (float)Game.ScoreMessagesRendererSize.X; double lcrh, lw, rw; CalculateViewingPlaneSize(Element, out lw, out rw, out lcrh); // start double w = Element.Alignment.X == 0 ? lw + rw + 128 : totalwidth + lw + rw; double h = Element.Value2 * n; double x = Element.Alignment.X < 0 ? 0.0 : Element.Alignment.X > 0 ? renderer.Screen.Width - w : 0.5 * (renderer.Screen.Width - w); double y = Element.Alignment.Y < 0 ? 0.0 : Element.Alignment.Y > 0 ? renderer.Screen.Height - h : 0.5 * (renderer.Screen.Height - h); x += Element.Position.X; y += Element.Position.Y; int m = 0; for (int j = 0; j < n; j++) { Color128 bc = Element.BackgroundColor.CreateBackColor(Game.ScoreMessages[j].Color, 1.0f); Color128 tc = Element.TextColor.CreateTextColor(Game.ScoreMessages[j].Color, 1.0f); Color128 oc = Element.OverlayColor.CreateTextColor(Game.ScoreMessages[j].Color, 1.0f); double tx, ty; bool preserve = false; if ((Element.Transition & HUD.Transition.Move) != 0) { if (Program.CurrentRoute.SecondsSinceMidnight < Game.ScoreMessages[j].Timeout) { if (Game.ScoreMessages[j].RendererAlpha == 0.0) { Game.ScoreMessages[j].RendererPosition.X = x + Element.TransitionVector.X; Game.ScoreMessages[j].RendererPosition.Y = y + Element.TransitionVector.Y; Game.ScoreMessages[j].RendererAlpha = 1.0; } tx = x; ty = y + m * Element.Value2; preserve = true; } else if (Element.Transition == HUD.Transition.MoveAndFade) { tx = x; ty = y + m * Element.Value2; } else { tx = x + Element.TransitionVector.X; ty = y + (j + 1) * Element.TransitionVector.Y; } const double speed = 2.0; double dx = (speed * Math.Abs(tx - Game.ScoreMessages[j].RendererPosition.X) + 0.1) * TimeElapsed; double dy = (speed * Math.Abs(ty - Game.ScoreMessages[j].RendererPosition.Y) + 0.1) * TimeElapsed; if (Math.Abs(tx - Game.ScoreMessages[j].RendererPosition.X) < dx) { Game.ScoreMessages[j].RendererPosition.X = tx; } else { Game.ScoreMessages[j].RendererPosition.X += Math.Sign(tx - Game.ScoreMessages[j].RendererPosition.X) * dx; } if (Math.Abs(ty - Game.ScoreMessages[j].RendererPosition.Y) < dy) { Game.ScoreMessages[j].RendererPosition.Y = ty; } else { Game.ScoreMessages[j].RendererPosition.Y += Math.Sign(ty - Game.ScoreMessages[j].RendererPosition.Y) * dy; } } else { tx = x; ty = y + m * Element.Value2; Game.ScoreMessages[j].RendererPosition.X = 0.0; const double speed = 12.0; double dy = (speed * Math.Abs(ty - Game.ScoreMessages[j].RendererPosition.Y) + 0.1) * TimeElapsed; Game.ScoreMessages[j].RendererPosition.X = x; if (Math.Abs(ty - Game.ScoreMessages[j].RendererPosition.Y) < dy) { Game.ScoreMessages[j].RendererPosition.Y = ty; } else { Game.ScoreMessages[j].RendererPosition.Y += Math.Sign(ty - Game.ScoreMessages[j].RendererPosition.Y) * dy; } } if ((Element.Transition & HUD.Transition.Fade) != 0) { if (Program.CurrentRoute.SecondsSinceMidnight >= Game.ScoreMessages[j].Timeout) { Game.ScoreMessages[j].RendererAlpha -= TimeElapsed; if (Game.ScoreMessages[j].RendererAlpha < 0.0) { Game.ScoreMessages[j].RendererAlpha = 0.0; } } else { Game.ScoreMessages[j].RendererAlpha += TimeElapsed; if (Game.ScoreMessages[j].RendererAlpha > 1.0) { Game.ScoreMessages[j].RendererAlpha = 1.0; } preserve = true; } } else if (Program.CurrentRoute.SecondsSinceMidnight > Game.ScoreMessages[j].Timeout) { if (Math.Abs(Game.ScoreMessages[j].RendererPosition.X - tx) < 0.1 & Math.Abs(Game.ScoreMessages[j].RendererPosition.Y - ty) < 0.1) { Game.ScoreMessages[j].RendererAlpha = 0.0; } } if (preserve) { m++; } double px = Game.ScoreMessages[j].RendererPosition.X + j * (double)Element.Value1; double py = Game.ScoreMessages[j].RendererPosition.Y; float alpha = (float)(Game.ScoreMessages[j].RendererAlpha * Game.ScoreMessages[j].RendererAlpha); // graphics HUD.Image Left = j == 0 ? Element.TopLeft : j < n - 1 ? Element.CenterLeft : Element.BottomLeft; HUD.Image Middle = j == 0 ? Element.TopMiddle : j < n - 1 ? Element.CenterMiddle : Element.BottomMiddle; HUD.Image Right = j == 0 ? Element.TopRight : j < n - 1 ? Element.CenterRight : Element.BottomRight; // left background if (Left.BackgroundTexture != null) { if (Program.CurrentHost.LoadTexture(Left.BackgroundTexture, OpenGlTextureWrapMode.ClampClamp)) { double u = Left.BackgroundTexture.Width; double v = Left.BackgroundTexture.Height; renderer.Rectangle.Draw(Left.BackgroundTexture, new Vector2(px, py), new Vector2(u, v), new Color128(bc.R, bc.G, bc.B, bc.A * alpha)); } } // right background if (Right.BackgroundTexture != null) { if (Program.CurrentHost.LoadTexture(Right.BackgroundTexture, OpenGlTextureWrapMode.ClampClamp)) { double u = Right.BackgroundTexture.Width; double v = Right.BackgroundTexture.Height; renderer.Rectangle.Draw(Right.BackgroundTexture, new Vector2(px + w - u, py), new Vector2(u, v), new Color128(bc.R, bc.G, bc.B, bc.A * alpha)); } } // middle background if (Middle.BackgroundTexture != null) { if (Program.CurrentHost.LoadTexture(Middle.BackgroundTexture, OpenGlTextureWrapMode.ClampClamp)) { double v = Middle.BackgroundTexture.Height; renderer.Rectangle.Draw(Middle.BackgroundTexture, new Vector2(px + lw, py), new Vector2(w - lw - rw, v), new Color128(bc.R, bc.G, bc.B, bc.A * alpha)); } } { // text string t = Game.ScoreMessages[j].Text; double u = widths[j]; double v = heights[j]; double p = Math.Round((Element.TextAlignment.X < 0 ? px : Element.TextAlignment.X > 0 ? px + w - u : px + 0.5 * (w - u)) - j * Element.Value1); double q = Math.Round(Element.TextAlignment.Y < 0 ? py : Element.TextAlignment.Y > 0 ? py + lcrh - v : py + 0.5 * (lcrh - v)); p += Element.TextPosition.X; q += Element.TextPosition.Y; renderer.OpenGlString.Draw(Element.Font, t, new Point((int)p, (int)q), TextAlignment.TopLeft, new Color128(tc.R, tc.G, tc.B, tc.A * alpha), Element.TextShadow); } // left overlay if (Left.OverlayTexture != null) { if (Program.CurrentHost.LoadTexture(Left.OverlayTexture, OpenGlTextureWrapMode.ClampClamp)) { double u = Left.OverlayTexture.Width; double v = Left.OverlayTexture.Height; renderer.Rectangle.Draw(Left.OverlayTexture, new Vector2(px, py), new Vector2(u, v), new Color128(oc.R, oc.G, oc.B, oc.A * alpha)); } } // right overlay if (Right.OverlayTexture != null) { if (Program.CurrentHost.LoadTexture(Right.OverlayTexture, OpenGlTextureWrapMode.ClampClamp)) { double u = Right.OverlayTexture.Width; double v = Right.OverlayTexture.Height; renderer.Rectangle.Draw(Right.OverlayTexture, new Vector2(px + w - u, py), new Vector2(u, v), new Color128(oc.R, oc.G, oc.B, oc.A * alpha)); } } // middle overlay if (Middle.OverlayTexture != null) { if (Program.CurrentHost.LoadTexture(Middle.OverlayTexture, OpenGlTextureWrapMode.ClampClamp)) { double v = Middle.OverlayTexture.Height; renderer.Rectangle.Draw(Middle.OverlayTexture, new Vector2(px + lw, py), new Vector2(w - lw - rw, v), new Color128(oc.R, oc.G, oc.B, oc.A * alpha)); } } } }
/// <summary>Renders the list of game (textual) messages</summary> /// <param name="Element">The HUD element these are to be rendered onto</param> /// <param name="TimeElapsed">The time elapsed</param> private void RenderGameMessages(HUD.Element Element, double TimeElapsed) { //Calculate the size of the viewing plane int n = MessageManager.TextualMessages.Count; //Minimum initial width is 16px double totalwidth = 16.0f; for (int j = 0; j < n; j++) { //Update font size for the renderer Vector2 size = Element.Font.MeasureString((string)MessageManager.TextualMessages[j].MessageToDisplay); MessageManager.TextualMessages[j].Width = size.X; MessageManager.TextualMessages[j].Height = size.Y; //Run through the list of current messages double a = MessageManager.TextualMessages[j].Width - j * (double)Element.Value1; //If our width is wider than the old, use this as the NEW viewing plane width if (a > totalwidth) { totalwidth = a; } } //Calculate the X-width of the viewing plane MessagesRendererSize.X += 16.0 * TimeElapsed * (totalwidth - MessagesRendererSize.X); totalwidth = (float)MessagesRendererSize.X; double lcrh, lw, rw; //Calculate final viewing plane size to pass to openGL CalculateViewingPlaneSize(Element, out lw, out rw, out lcrh); // start double w = totalwidth + lw + rw; double h = Element.Value2 * n; double x = Element.Alignment.X < 0 ? 0.0 : Element.Alignment.X > 0 ? renderer.Screen.Width - w : 0.5 * (renderer.Screen.Width - w); double y = Element.Alignment.Y < 0 ? 0.0 : Element.Alignment.Y > 0 ? renderer.Screen.Height - h : 0.5 * (renderer.Screen.Height - h); x += Element.Position.X; y += Element.Position.Y; int m = 0; for (int j = 0; j < n; j++) { RouteManager2.MessageManager.AbstractMessage mm = MessageManager.TextualMessages[j]; Color128 bc = Element.BackgroundColor.CreateBackColor(mm.Color, 1.0f); Color128 tc = Element.TextColor.CreateTextColor(mm.Color, 1.0f); Color128 oc = Element.OverlayColor.CreateBackColor(mm.Color, 1.0f); double tx, ty; bool preserve = false; if ((Element.Transition & HUD.Transition.Move) != 0) { if (Program.CurrentRoute.SecondsSinceMidnight < mm.Timeout) { if (mm.RendererAlpha == 0.0) { mm.RendererPosition.X = x + Element.TransitionVector.X; mm.RendererPosition.Y = y + Element.TransitionVector.Y; mm.RendererAlpha = 1.0; } tx = x; ty = y + m * Element.Value2; preserve = true; } else if (Element.Transition == HUD.Transition.MoveAndFade) { tx = x; ty = y + m * Element.Value2; } else { tx = x + Element.TransitionVector.X; ty = y + (j + 1) * Element.TransitionVector.Y; } const double speed = 2.0; double dx = (speed * Math.Abs(tx - mm.RendererPosition.X) + 0.1) * TimeElapsed; double dy = (speed * Math.Abs(ty - mm.RendererPosition.Y) + 0.1) * TimeElapsed; if (Math.Abs(tx - mm.RendererPosition.X) < dx) { mm.RendererPosition.X = tx; } else { mm.RendererPosition.X += Math.Sign(tx - mm.RendererPosition.X) * dx; } if (Math.Abs(ty - mm.RendererPosition.Y) < dy) { mm.RendererPosition.Y = ty; } else { mm.RendererPosition.Y += Math.Sign(ty - mm.RendererPosition.Y) * dy; } } else { tx = x; ty = y + m * Element.Value2; mm.RendererPosition.X = 0.0; const double speed = 12.0; double dy = (speed * Math.Abs(ty - mm.RendererPosition.Y) + 0.1) * TimeElapsed; mm.RendererPosition.X = x; if (Math.Abs(ty - mm.RendererPosition.Y) < dy) { mm.RendererPosition.Y = ty; } else { mm.RendererPosition.Y += Math.Sign(ty - mm.RendererPosition.Y) * dy; } } if ((Element.Transition & HUD.Transition.Fade) != 0) { if (Program.CurrentRoute.SecondsSinceMidnight >= mm.Timeout) { mm.RendererAlpha -= TimeElapsed; if (mm.RendererAlpha < 0.0) { mm.RendererAlpha = 0.0; } } else { mm.RendererAlpha += TimeElapsed; if (mm.RendererAlpha > 1.0) { mm.RendererAlpha = 1.0; } preserve = true; } } else if (Program.CurrentRoute.SecondsSinceMidnight > mm.Timeout) { if (Math.Abs(mm.RendererPosition.X - tx) < 0.1 & Math.Abs(mm.RendererPosition.Y - ty) < 0.1) { mm.RendererAlpha = 0.0; } } if (preserve) { m++; } double px = mm.RendererPosition.X + j * (double)Element.Value1; double py = mm.RendererPosition.Y; float alpha = (float)(mm.RendererAlpha * mm.RendererAlpha); // graphics HUD.Image Left = j == 0 ? Element.TopLeft : j < n - 1 ? Element.CenterLeft : Element.BottomLeft; HUD.Image Middle = j == 0 ? Element.TopMiddle : j < n - 1 ? Element.CenterMiddle : Element.BottomMiddle; HUD.Image Right = j == 0 ? Element.TopRight : j < n - 1 ? Element.CenterRight : Element.BottomRight; // left background if (Left.BackgroundTexture != null) { if (Program.CurrentHost.LoadTexture(Left.BackgroundTexture, OpenGlTextureWrapMode.ClampClamp)) { double u = Left.BackgroundTexture.Width; double v = Left.BackgroundTexture.Height; renderer.Rectangle.Draw(Left.BackgroundTexture, new Vector2(px, py), new Vector2(u, v), new Color128(bc.R, bc.G, bc.B, bc.A * alpha)); } } // right background if (Right.BackgroundTexture != null) { if (Program.CurrentHost.LoadTexture(Right.BackgroundTexture, OpenGlTextureWrapMode.ClampClamp)) { double u = Right.BackgroundTexture.Width; double v = Right.BackgroundTexture.Height; renderer.Rectangle.Draw(Right.BackgroundTexture, new Vector2(px + w - u, py), new Vector2(u, v), new Color128(bc.R, bc.G, bc.B, bc.A * alpha)); } } // middle background if (Middle.BackgroundTexture != null) { if (Program.CurrentHost.LoadTexture(Middle.BackgroundTexture, OpenGlTextureWrapMode.ClampClamp)) { double v = Middle.BackgroundTexture.Height; renderer.Rectangle.Draw(Middle.BackgroundTexture, new Vector2(px + lw, py), new Vector2(w - lw - rw, v), new Color128(bc.R, bc.G, bc.B, bc.A * alpha)); } } { // text string t = (string)mm.MessageToDisplay; double u = mm.Width; double v = mm.Height; double p = Math.Round( (Element.TextAlignment.X < 0 ? px : Element.TextAlignment.X > 0 ? px + w - u : px + 0.5 * (w - u)) - j * Element.Value1); double q = Math.Round(Element.TextAlignment.Y < 0 ? py : Element.TextAlignment.Y > 0 ? py + lcrh - v : py + 0.5 * (lcrh - v)); p += Element.TextPosition.X; q += Element.TextPosition.Y; renderer.OpenGlString.Draw(Element.Font, t, new Vector2(p, q), TextAlignment.TopLeft, new Color128(tc.R, tc.G, tc.B, tc.A * alpha), Element.TextShadow); } // left overlay if (Left.OverlayTexture != null) { if (Program.CurrentHost.LoadTexture(Left.OverlayTexture, OpenGlTextureWrapMode.ClampClamp)) { double u = Left.OverlayTexture.Width; double v = Left.OverlayTexture.Height; renderer.Rectangle.Draw(Left.OverlayTexture, new Vector2(px, py), new Vector2(u, v), new Color128(oc.R, oc.G, oc.B, oc.A * alpha)); } } // right overlay if (Right.OverlayTexture != null) { if (Program.CurrentHost.LoadTexture(Right.OverlayTexture, OpenGlTextureWrapMode.ClampClamp)) { double u = Right.OverlayTexture.Width; double v = Right.OverlayTexture.Height; renderer.Rectangle.Draw(Right.OverlayTexture, new Vector2(px + w - u, py), new Vector2(u, v), new Color128(oc.R, oc.G, oc.B, oc.A * alpha)); } } // middle overlay if (Middle.OverlayTexture != null) { if (Program.CurrentHost.LoadTexture(Middle.OverlayTexture, OpenGlTextureWrapMode.ClampClamp)) { double v = Middle.OverlayTexture.Height; renderer.Rectangle.Draw(Middle.OverlayTexture, new Vector2(px + lw, py), new Vector2(w - lw - rw, v), new Color128(oc.R, oc.G, oc.B, oc.A * alpha)); } } if (Element.Font.FontSize >= 20.0) { //Add a little more line-padding to the large font sizes //Asian and some Cyrillic charsets otherwise overlap slightly y += 10; } } }