diff --git a/Launcher2/Gui/Screens/LauncherInputScreen.cs b/Launcher2/Gui/Screens/LauncherInputScreen.cs
index a6a7bb3ac..cd6aabdbf 100644
--- a/Launcher2/Gui/Screens/LauncherInputScreen.cs
+++ b/Launcher2/Gui/Screens/LauncherInputScreen.cs
@@ -178,13 +178,8 @@ namespace Launcher {
protected void MakeInput( string text, int width, Anchor verAnchor, bool password,
int x, int y, int maxChars, string hint ) {
- MakeInput( text, width, Anchor.Centre, verAnchor, password, x, y, maxChars, hint );
- }
-
- protected void MakeInput( string text, int width, Anchor horAnchor, Anchor verAnchor,
- bool password, int x, int y, int maxChars, string hint ) {
WidgetConstructors.MakeInput( game, widgets, ref widgetIndex,
- text, width, horAnchor, verAnchor,
+ text, width, Anchor.Centre, verAnchor,
inputFont, inputHintFont, InputClick,
password, x, y, maxChars, hint );
}
diff --git a/Launcher2/Gui/Screens/ResourcesScreen.cs b/Launcher2/Gui/Screens/ResourcesScreen.cs
index a4c393811..be823d72b 100644
--- a/Launcher2/Gui/Screens/ResourcesScreen.cs
+++ b/Launcher2/Gui/Screens/ResourcesScreen.cs
@@ -10,6 +10,7 @@ namespace Launcher {
public sealed class ResourcesScreen : LauncherScreen {
Font infoFont, statusFont;
+ ResourcesView view;
public ResourcesScreen( LauncherWindow game ) : base( game ) {
game.Window.Mouse.Move += MouseMove;
game.Window.Mouse.ButtonDown += MouseButtonDown;
@@ -18,10 +19,15 @@ namespace Launcher {
infoFont = new Font( game.FontName, 14, FontStyle.Regular );
statusFont = new Font( game.FontName, 13, FontStyle.Italic );
buttonFont = textFont;
- widgets = new LauncherWidget[4];
+ view = new ResourcesView( game );
+ widgets = view.widgets;
}
- public override void Init() { Resize(); }
+ public override void Init() {
+ view.Init();
+ MakeWidgets();
+ Resize();
+ }
bool failed;
public override void Tick() {
@@ -45,46 +51,25 @@ namespace Launcher {
public override void Resize() {
MakeWidgets();
- using( drawer ) {
- drawer.SetBitmap( game.Framebuffer );
- drawer.Clear( clearCol );
- drawer.Clear( backCol, game.Width / 2 - 190, game.Height / 2 - 70, 190 * 2, 70 * 2 );
- }
-
- RedrawAllButtonBackgrounds();
- using( drawer ) {
- drawer.SetBitmap( game.Framebuffer );
- RedrawAll();
- }
+ view.DrawAll();
Dirty = true;
}
- int lastProgress = int.MinValue;
void CheckCurrentProgress() {
Request item = fetcher.downloader.CurrentItem;
if( item == null ) {
- lastProgress = int.MinValue; return;
+ view.lastProgress = int.MinValue; return;
}
int progress = fetcher.downloader.CurrentItemProgress;
- if( progress == lastProgress ) return;
- lastProgress = progress;
+ if( progress == view.lastProgress ) return;
+ view.lastProgress = progress;
SetFetchStatus( progress );
}
void SetFetchStatus( int progress ) {
- if( progress >= 0 && progress <= 100 )
- DrawProgressBox( progress );
- }
-
- static FastColour progBack = new FastColour( 220, 220, 220 );
- static FastColour progFront = new FastColour( 0, 220, 0 );
- void DrawProgressBox( int progress ) {
- progress = (200 * progress) / 100;
- using( drawer ) {
- drawer.SetBitmap( game.Framebuffer );
- drawer.DrawRect( progBack, game.Width / 2 - 100, game.Height / 2 + 10, 200, 4 );
- drawer.DrawRect( progFront, game.Width / 2 - 100, game.Height / 2 + 10, progress, 4 );
+ if( progress >= 0 && progress <= 100 ) {
+ view.DrawProgressBox( progress );
Dirty = true;
}
}
@@ -127,8 +112,10 @@ namespace Launcher {
0, 45, (x, y) => GotoNextMenu() );
}
- if( lastProgress >= 0 && lastProgress <= 100 )
- DrawProgressBox( lastProgress );
+ if( view.lastProgress >= 0 && view.lastProgress <= 100 ) {
+ view.DrawProgressBox( view.lastProgress );
+ Dirty = true;
+ }
}
void DownloadResources( int mouseX, int mouseY ) {
diff --git a/Launcher2/Gui/Views/ResourcesView.cs b/Launcher2/Gui/Views/ResourcesView.cs
new file mode 100644
index 000000000..05131cb56
--- /dev/null
+++ b/Launcher2/Gui/Views/ResourcesView.cs
@@ -0,0 +1,46 @@
+// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
+using System;
+using ClassicalSharp;
+
+namespace Launcher {
+
+ public sealed class ResourcesView : IView {
+
+ public ResourcesView( LauncherWindow game ) : base( game ) {
+ widgets = new LauncherWidget[4];
+ }
+
+ public override void Init() {
+ // TODO: figure out how to fix this.
+ }
+
+ public override void DrawAll() {
+ using( drawer ) {
+ drawer.SetBitmap( game.Framebuffer );
+ drawer.Clear( clearCol );
+ drawer.Clear( backCol, game.Width / 2 - 190, game.Height / 2 - 70, 190 * 2, 70 * 2 );
+ }
+
+ RedrawAllButtonBackgrounds();
+ using( drawer ) {
+ drawer.SetBitmap( game.Framebuffer );
+ RedrawAll();
+ }
+ }
+
+ internal void DrawProgressBox( int progress ) {
+ progress = (200 * progress) / 100;
+ using( drawer ) {
+ drawer.SetBitmap( game.Framebuffer );
+ drawer.DrawRect( progBack, game.Width / 2 - 100, game.Height / 2 + 10, 200, 4 );
+ drawer.DrawRect( progFront, game.Width / 2 - 100, game.Height / 2 + 10, progress, 4 );
+ }
+ }
+
+ internal int lastProgress = int.MinValue;
+ static FastColour backCol = new FastColour( 120, 85, 151 );
+ static FastColour clearCol = new FastColour( 12, 12, 12 );
+ static FastColour progBack = new FastColour( 220, 220, 220 );
+ static FastColour progFront = new FastColour( 0, 220, 0 );
+ }
+}
diff --git a/Launcher2/Launcher2.csproj b/Launcher2/Launcher2.csproj
index 72f51defc..229a8e836 100644
--- a/Launcher2/Launcher2.csproj
+++ b/Launcher2/Launcher2.csproj
@@ -77,6 +77,7 @@
+