using System; using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Text; using System.Runtime.InteropServices; using System.Text; using System.Windows.Forms; internal class Splash : Form { private const int W = 640; private const int H = 360; private Timer t = new Timer(); private Stopwatch sw = Stopwatch.StartNew(); private MainForm main; private bool shown; private string status = "Starting Floppa.."; private float prog; private string[] art = new string[7]; private static string[][] L = new string[6][] { new string[7] { "#####", "# ", "# ", "#### ", "# ", "# ", "# " }, new string[7] { "# ", "# ", "# ", "# ", "# ", "# ", "#####" }, new string[7] { " ### ", "# #", "# #", "# #", "# #", "# #", " ### " }, new string[7] { "#### ", "# #", "# #", "#### ", "# ", "# ", "# " }, new string[7] { "#### ", "# #", "# #", "#### ", "# ", "# ", "# " }, new string[7] { " ### ", "# #", "# #", "#####", "# #", "# #", "# #" } }; [DllImport("gdi32")] private static extern IntPtr CreateRoundRectRgn(int a, int b, int c, int d, int e, int f); public Splash() { FormBorderStyle = FormBorderStyle.None; StartPosition = FormStartPosition.CenterScreen; ClientSize = new Size(640, 360); Opacity = 0.0; DoubleBuffered = true; ShowInTaskbar = false; BackColor = G.Acc; Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, 641, 361, 24, 24)); for (int i = 0; i < 7; i++) { StringBuilder stringBuilder = new StringBuilder(); string[][] l = L; foreach (string[] array in l) { stringBuilder.Append(array[i]).Append(" "); } art[i] = stringBuilder.ToString().TrimEnd(); } t.Interval = 15; t.Tick += Step; t.Start(); } private void Step(object s, EventArgs e) { double totalMilliseconds = sw.Elapsed.TotalMilliseconds; prog = (float)Math.Min(1.0, totalMilliseconds / 2700.0); ref string reference = ref status; string text; if (totalMilliseconds < 700.0) { text = "Starting Floppa.."; } else if (totalMilliseconds < 1400.0) { text = "Loading settings.."; } else { text = ((totalMilliseconds < 2100.0) ? "Searching for Minecraft.." : "Ready"); } reference = text; if (totalMilliseconds >= 1500.0 && main == null) { main = new MainForm(); main.FormClosed += (object param0, FormClosedEventArgs param1) => { Close(); }; } if (totalMilliseconds < 350.0) { Opacity = totalMilliseconds / 350.0; } else if (totalMilliseconds < 2800.0) { Opacity = 1.0; } else { if (!shown && main != null) { shown = true; main.Show(); } Opacity = Math.Max(0.0, 1.0 - (totalMilliseconds - 2800.0) / 350.0); if (totalMilliseconds >= 3200.0) { t.Stop(); Hide(); } } Invalidate(); } protected override void OnPaint(PaintEventArgs e) { Graphics graphics = e.Graphics; graphics.SmoothingMode = SmoothingMode.AntiAlias; graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; graphics.Clear(G.Acc); using Font font = new Font("Consolas", 17f, FontStyle.Bold); using Font font2 = new Font("Consolas", 11f, FontStyle.Bold); using SolidBrush brush = new SolidBrush(Color.FromArgb(10, 10, 10)); StringFormat genericTypographic = StringFormat.GenericTypographic; float num = graphics.MeasureString("#", font, 0, genericTypographic).Width; float num2 = (float)font.Height * 0.95f; float num3 = 70f; string[] array = art; foreach (string text in array) { graphics.DrawString(text, font, brush, (640f - num * (float)text.Length) / 2f, num3, genericTypographic); num3 += num2; } SizeF sizeF = graphics.MeasureString(status, font2, 0, genericTypographic); graphics.DrawString(status, font2, brush, (640f - sizeF.Width) / 2f, num3 + 34f, genericTypographic); G.Fill(graphics, new RectangleF(210f, num3 + 68f, 220f, 5f), 2f, G.Mix(G.Acc, Color.Black, 0.2f)); G.Fill(graphics, new RectangleF(210f, num3 + 68f, Math.Max(5f, 220f * prog), 5f), 2f, Color.FromArgb(10, 10, 10)); } }