Komplettumbau und Splashscreen sollte jetzt funktionieren (Muss noch getestet werden)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
@@ -10,9 +11,19 @@ namespace WorldOfPeacecraft
|
||||
private string ImagesFolder = "textures/";
|
||||
private Image Logo;
|
||||
private Music m = new Music();
|
||||
private Gui gui;
|
||||
private IBackend backend;
|
||||
|
||||
public SplashScreen ()
|
||||
public delegate void GuiHasLoadedEventHandler (SplashScreen screen, Gui gui);
|
||||
public event GuiHasLoadedEventHandler GuiHasLoaded;
|
||||
|
||||
public SplashScreen (Gui gui, IBackend backend)
|
||||
{
|
||||
this.gui = gui;
|
||||
this.backend = backend;
|
||||
Thread t = new Thread (ThreadEntry);
|
||||
t.Start ();
|
||||
this.SetClientSizeCore (450, 150);
|
||||
Logo = Image.FromFile (ImagesFolder + "splashscreen.png");
|
||||
m.Playmusic ("splashscreen");
|
||||
}
|
||||
@@ -23,6 +34,14 @@ namespace WorldOfPeacecraft
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user