49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using System;
|
|
using System.Threading;
|
|
using System.Drawing;
|
|
using System.Drawing.Drawing2D;
|
|
using System.Windows.Forms;
|
|
|
|
namespace WorldOfPeacecraft
|
|
{
|
|
public class SplashScreen : Form
|
|
{
|
|
private string ImagesFolder = "textures/";
|
|
private Image Logo;
|
|
//private Music m = new Music();
|
|
private Gui gui;
|
|
private IBackend backend;
|
|
|
|
public delegate void GuiHasLoadedEventHandler (SplashScreen screen, Gui gui);
|
|
public event GuiHasLoadedEventHandler GuiHasLoaded;
|
|
|
|
public SplashScreen (Gui gui, IBackend backend)
|
|
{
|
|
this.gui = gui;
|
|
gui.MainForm = this;
|
|
this.backend = backend;
|
|
Thread t = new Thread (ThreadEntry);
|
|
t.Start ();
|
|
this.SetClientSizeCore (450, 150);
|
|
Logo = Image.FromFile (ImagesFolder + "splashscreen.png");
|
|
//m.Playmusic ("splashscreen");
|
|
}
|
|
|
|
protected override void OnPaint (PaintEventArgs e)
|
|
{
|
|
Graphics g = e.Graphics;
|
|
g.InterpolationMode = InterpolationMode.Low;
|
|
g.DrawImage (Logo, 0, 0, 450, 150);
|
|
}
|
|
|
|
private void ThreadEntry(){
|
|
gui.LoadResources ();
|
|
backend.Connect ();
|
|
Thread.Sleep (1000);
|
|
if (GuiHasLoaded != null)
|
|
GuiHasLoaded (this,gui);
|
|
}
|
|
}
|
|
}
|
|
|