From 06b05626950c9a7e80b28db98ff29b570405093d Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 31 Dec 2015 15:26:04 +1100 Subject: [PATCH] Touchup launcher a bit and make default height 40 pixels smaller, also fix clicking 'use sounds' multiple times causing the client to crash. --- ClassicalSharp/2D/IsometricBlockDrawer.cs | 2 +- ClassicalSharp/Audio/AudioPlayer.Sounds.cs | 4 +++- .../Gui/Screens/ClassiCubeServersScreen.cs | 6 ++--- Launcher2/Gui/Screens/ColoursScreen.cs | 24 +++++++++---------- .../Gui/Screens/MainScreen.Classicube.cs | 10 ++++---- Launcher2/Gui/Screens/MainScreen.cs | 2 +- Launcher2/Gui/Screens/UpdatesScreen.cs | 10 ++++---- .../TableWidget/LauncherTableWidget.Input.cs | 2 +- .../Gui/TableWidget/LauncherTableWidget.cs | 8 +++---- Launcher2/LauncherWindow.Background.cs | 4 ++-- Launcher2/LauncherWindow.cs | 2 +- 11 files changed, 37 insertions(+), 37 deletions(-) diff --git a/ClassicalSharp/2D/IsometricBlockDrawer.cs b/ClassicalSharp/2D/IsometricBlockDrawer.cs index c7f2c652c..faa2c29f3 100644 --- a/ClassicalSharp/2D/IsometricBlockDrawer.cs +++ b/ClassicalSharp/2D/IsometricBlockDrawer.cs @@ -128,7 +128,7 @@ namespace ClassicalSharp { rec.U1 = uOrigin + minBB.Z * invElemSize; rec.U2 = uOrigin + maxBB.Z * invElemSize * 15.99f/16f; rec.V1 = vOrigin + minBB.Y * invElemSize; - rec.V2 = vOrigin + maxBB.Y * invElemSize; + rec.V2 = vOrigin + maxBB.Y * invElemSize * 15.99f/16f; cache.vertices[index++] = new VertexPos3fTex2fCol4b( pos.X + x, pos.Y + Make( minBB.Y ), pos.Z + Make( minBB.Z ), rec.U2, rec.V2, col ); diff --git a/ClassicalSharp/Audio/AudioPlayer.Sounds.cs b/ClassicalSharp/Audio/AudioPlayer.Sounds.cs index 147815e4d..56263af3f 100644 --- a/ClassicalSharp/Audio/AudioPlayer.Sounds.cs +++ b/ClassicalSharp/Audio/AudioPlayer.Sounds.cs @@ -83,8 +83,10 @@ namespace ClassicalSharp.Audio { void DisposeSound() { DisposeOutputs( ref monoOutputs ); DisposeOutputs( ref stereoOutputs ); - if( firstSoundOut != null ) + if( firstSoundOut != null ) { firstSoundOut.Dispose(); + firstSoundOut = null; + } } void DisposeOutputs( ref IAudioOutput[] outputs ) { diff --git a/Launcher2/Gui/Screens/ClassiCubeServersScreen.cs b/Launcher2/Gui/Screens/ClassiCubeServersScreen.cs index 44c3b778f..366671526 100644 --- a/Launcher2/Gui/Screens/ClassiCubeServersScreen.cs +++ b/Launcher2/Gui/Screens/ClassiCubeServersScreen.cs @@ -8,11 +8,10 @@ namespace Launcher2 { public sealed class ClassiCubeServersScreen : LauncherInputScreen { const int tableIndex = 4, searchIndex = 0, hashIndex = 1; - Font boldInputFont, tableFont; + Font tableFont; const int tableX = 10, tableY = 50; - public ClassiCubeServersScreen( LauncherWindow game ) : base( game, true ) { - boldInputFont = new Font( "Arial", 14, FontStyle.Bold ); + public ClassiCubeServersScreen( LauncherWindow game ) : base( game, true ) { tableFont = new Font( "Arial", 11, FontStyle.Regular ); enterIndex = 3; widgets = new LauncherWidget[7]; @@ -183,7 +182,6 @@ namespace Launcher2 { public override void Dispose() { base.Dispose(); - boldInputFont.Dispose(); tableFont.Dispose(); game.Window.Mouse.WheelChanged -= MouseWheelChanged; diff --git a/Launcher2/Gui/Screens/ColoursScreen.cs b/Launcher2/Gui/Screens/ColoursScreen.cs index c5fbe3ffa..042a1c73b 100644 --- a/Launcher2/Gui/Screens/ColoursScreen.cs +++ b/Launcher2/Gui/Screens/ColoursScreen.cs @@ -31,25 +31,25 @@ namespace Launcher2 { void Draw() { widgetIndex = 0; - MakeLabelAt( "Background", titleFont, Anchor.Centre, Anchor.Centre, -70, -150 ); - MakeInput( GetCol( LauncherSkin.BackgroundCol ), 90, Anchor.Centre, false, 45, -150, 6, null ); + MakeLabelAt( "Background", titleFont, Anchor.Centre, Anchor.Centre, -70, -120 ); + MakeInput( GetCol( LauncherSkin.BackgroundCol ), 90, Anchor.Centre, false, 45, -120, 6, null ); - MakeLabelAt( "Button border", titleFont, Anchor.Centre, Anchor.Centre, -80, -110 ); - MakeInput( GetCol( LauncherSkin.ButtonBorderCol ), 90, Anchor.Centre, false, 45, -110, 6, null ); + MakeLabelAt( "Button border", titleFont, Anchor.Centre, Anchor.Centre, -80, -80 ); + MakeInput( GetCol( LauncherSkin.ButtonBorderCol ), 90, Anchor.Centre, false, 45, -80, 6, null ); - MakeLabelAt( "Button highlight", titleFont, Anchor.Centre, Anchor.Centre, -90, -70 ); - MakeInput( GetCol( LauncherSkin.ButtonHighlightCol ), 90, Anchor.Centre, false, 45, -70, 6, null ); + MakeLabelAt( "Button highlight", titleFont, Anchor.Centre, Anchor.Centre, -90, -40 ); + MakeInput( GetCol( LauncherSkin.ButtonHighlightCol ), 90, Anchor.Centre, false, 45, -40, 6, null ); - MakeLabelAt( "Button foreground", titleFont, Anchor.Centre, Anchor.Centre, -100, -30 ); - MakeInput( GetCol( LauncherSkin.ButtonForeCol ), 90, Anchor.Centre, false, 45, -30, 6, null ); + MakeLabelAt( "Button foreground", titleFont, Anchor.Centre, Anchor.Centre, -100, 0 ); + MakeInput( GetCol( LauncherSkin.ButtonForeCol ), 90, Anchor.Centre, false, 45, 2, 6, null ); - MakeLabelAt( "Active button foreground", titleFont, Anchor.Centre, Anchor.Centre, -130, 10 ); - MakeInput( GetCol( LauncherSkin.ButtonForeActiveCol ), 90, Anchor.Centre, false, 45, 10, 6, null ); + MakeLabelAt( "Active button foreground", titleFont, Anchor.Centre, Anchor.Centre, -130, 40 ); + MakeInput( GetCol( LauncherSkin.ButtonForeActiveCol ), 90, Anchor.Centre, false, 45, 40, 6, null ); MakeButtonAt( "Default colours", 160, 35, titleFont, Anchor.Centre, - 0, 70, (x, y) => ResetColours() ); + 0, 100, (x, y) => ResetColours() ); MakeButtonAt( "Back", 80, 35, titleFont, Anchor.Centre, - 0, 120, (x, y) => game.SetScreen( new MainScreen( game ) ) ); + 0, 170, (x, y) => game.SetScreen( new MainScreen( game ) ) ); for( int i = 0; i < widgets.Length; i++ ) { LauncherInputWidget input = widgets[i] as LauncherInputWidget; if( input != null ) input.TextChanged = TextChanged; diff --git a/Launcher2/Gui/Screens/MainScreen.Classicube.cs b/Launcher2/Gui/Screens/MainScreen.Classicube.cs index 77a395f8a..0ede2dc6b 100644 --- a/Launcher2/Gui/Screens/MainScreen.Classicube.cs +++ b/Launcher2/Gui/Screens/MainScreen.Classicube.cs @@ -41,12 +41,12 @@ namespace Launcher2 { } void DrawClassicube() { - MakeInput( Get(), 280, Anchor.Centre, false, 0, -150, 32, "&7Username.." ); - MakeInput( Get(), 280, Anchor.Centre, true, 0, -100, 32, "&7Password.." ); + MakeInput( Get(), 280, Anchor.Centre, false, 0, -115, 32, "&7Username.." ); + MakeInput( Get(), 280, Anchor.Centre, true, 0, -70, 32, "&7Password.." ); MakeButtonAt( "Sign in", 100, buttonHeight, buttonFont, - Anchor.Centre, Anchor.Centre, -90, -50, LoginAsync ); - MakeLabelAt( Get(), inputFont, Anchor.Centre, Anchor.Centre, 0, 0 ); + Anchor.Centre, Anchor.Centre, -90, -20, LoginAsync ); + MakeLabelAt( Get(), inputFont, Anchor.Centre, Anchor.Centre, 0, 20 ); } string lastStatus; @@ -62,7 +62,7 @@ namespace Launcher2 { LauncherLabelWidget widget = (LauncherLabelWidget)widgets[3]; game.ClearArea( widget.X, widget.Y, widget.Width, widget.Height ); - widget.DrawAt( drawer, text, inputFont, Anchor.Centre, Anchor.Centre, 0, 0 ); + widget.DrawAt( drawer, text, inputFont, Anchor.Centre, Anchor.Centre, 0, 20 ); Dirty = true; } diff --git a/Launcher2/Gui/Screens/MainScreen.cs b/Launcher2/Gui/Screens/MainScreen.cs index be8541bae..2c4899e2e 100644 --- a/Launcher2/Gui/Screens/MainScreen.cs +++ b/Launcher2/Gui/Screens/MainScreen.cs @@ -27,7 +27,7 @@ namespace Launcher2 { DrawClassicube(); MakeButtonAt( "Resume", 100, buttonHeight, buttonFont, - Anchor.Centre, Anchor.Centre, 90, -50, ResumeClick ); + Anchor.Centre, Anchor.Centre, 90, -20, ResumeClick ); MakeButtonAt( "Direct connect", 200, buttonHeight, buttonFont, Anchor.Centre, Anchor.Centre, 0, 80, diff --git a/Launcher2/Gui/Screens/UpdatesScreen.cs b/Launcher2/Gui/Screens/UpdatesScreen.cs index c99bf1f0c..48acc4b49 100644 --- a/Launcher2/Gui/Screens/UpdatesScreen.cs +++ b/Launcher2/Gui/Screens/UpdatesScreen.cs @@ -89,21 +89,21 @@ namespace Launcher2 { MakeLabelAt( "Latest stable:", titleFont, Anchor.Centre, Anchor.Centre, -70, -80 ); string latestStable = GetDateString( lastStable, validStable ); MakeLabelAt( latestStable, infoFont, Anchor.Centre, Anchor.Centre, 100, -80 ); - MakeButtonAt( "Update to D3D9 stable", 260, 30, titleFont, Anchor.Centre, 0, -40, + MakeButtonAt( "Update to D3D9 stable", 270, 30, titleFont, Anchor.Centre, 0, -40, (x, y) => UpdateBuild( lastStable, validStable, true, true ) ); - MakeButtonAt( "Update to OpenGL stable", 260, 30, titleFont, Anchor.Centre, 0, 0, + MakeButtonAt( "Update to OpenGL stable", 270, 30, titleFont, Anchor.Centre, 0, 0, (x, y) => UpdateBuild( lastStable, validStable, true, false ) ); MakeLabelAt( "Latest dev:", titleFont, Anchor.Centre, Anchor.Centre, -60, 40 ); string latestDev = GetDateString( lastDev, validDev ); MakeLabelAt( latestDev, infoFont, Anchor.Centre, Anchor.Centre, 100, 40 ); - MakeButtonAt( "Update to D3D9 dev", 240, 30, titleFont, Anchor.Centre, 0, 80, + MakeButtonAt( "Update to D3D9 dev", 250, 30, titleFont, Anchor.Centre, 0, 80, (x, y) => UpdateBuild( lastDev, validDev, false, true ) ); - MakeButtonAt( "Update to OpenGL dev", 240, 30, titleFont, Anchor.Centre, 0, 120, + MakeButtonAt( "Update to OpenGL dev", 250, 30, titleFont, Anchor.Centre, 0, 120, (x, y) => UpdateBuild( lastDev, validDev, false, false ) ); MakeButtonAt( "Back", 80, 35, titleFont, Anchor.Centre, - 0, 200, (x, y) => game.SetScreen( new MainScreen( game ) ) ); + 0, 170, (x, y) => game.SetScreen( new MainScreen( game ) ) ); } string GetDateString( DateTime last, bool valid ) { diff --git a/Launcher2/Gui/TableWidget/LauncherTableWidget.Input.cs b/Launcher2/Gui/TableWidget/LauncherTableWidget.Input.cs index eb9bd0d48..38e8fcc5f 100644 --- a/Launcher2/Gui/TableWidget/LauncherTableWidget.Input.cs +++ b/Launcher2/Gui/TableWidget/LauncherTableWidget.Input.cs @@ -73,7 +73,7 @@ namespace Launcher2 { void GetSelectedServer( int mouseX, int mouseY ) { for( int i = 0; i < Count; i++ ) { TableEntry entry = usedEntries[i]; - if( mouseY < entry.Y || mouseY >= entry.Y + entry.Height + 3 ) continue; + if( mouseY < entry.Y || mouseY >= entry.Y + entry.Height + 2 ) continue; if( lastIndex == i && (DateTime.UtcNow - lastPress).TotalSeconds < 1 ) { Window.ConnectToServer( servers, entry.Hash ); diff --git a/Launcher2/Gui/TableWidget/LauncherTableWidget.cs b/Launcher2/Gui/TableWidget/LauncherTableWidget.cs index 195b85fb7..a8ffca244 100644 --- a/Launcher2/Gui/TableWidget/LauncherTableWidget.cs +++ b/Launcher2/Gui/TableWidget/LauncherTableWidget.cs @@ -58,8 +58,8 @@ namespace Launcher2 { } public int CurrentIndex, Count; - public int[] ColumnWidths = { 350, 65, 65, 140 }; - public int[] DesiredColumnWidths = { 350, 65, 65, 140 }; + public int[] ColumnWidths = { 340, 65, 65, 140 }; + public int[] DesiredColumnWidths = { 340, 65, 65, 140 }; int defaultInputHeight; internal struct TableEntry { @@ -131,7 +131,7 @@ namespace Launcher2 { if( empty ) size.Height = defaultInputHeight; if( y + size.Height > Y + Height ) { - y = Y + Height + 3; return false; + y = Y + Height + 2; return false; } entry.Y = y; entry.Height = size.Height; @@ -140,7 +140,7 @@ namespace Launcher2 { args.SkipPartsCheck = false; drawer.DrawClippedText( ref args, x, y, maxWidth, 30 ); } - y += size.Height + 3; + y += size.Height + 2; return true; } diff --git a/Launcher2/LauncherWindow.Background.cs b/Launcher2/LauncherWindow.Background.cs index 57546cc28..3ad38d300 100644 --- a/Launcher2/LauncherWindow.Background.cs +++ b/Launcher2/LauncherWindow.Background.cs @@ -53,9 +53,9 @@ namespace Launcher2 { int xStart = Width / 2 - size.Width / 2; args.Text = "&0Classical&0Sharp"; - drawer.DrawChatText( ref args, xStart + 5, 20 + 5 ); + drawer.DrawChatText( ref args, xStart + 5, 10 + 5 ); args.Text = "&eClassical&fSharp"; - drawer.DrawChatText( ref args, xStart, 20 ); + drawer.DrawChatText( ref args, xStart, 10 ); drawer.UseBitmappedChat = false; } Dirty = true; diff --git a/Launcher2/LauncherWindow.cs b/Launcher2/LauncherWindow.cs index aadafa32a..646be021a 100644 --- a/Launcher2/LauncherWindow.cs +++ b/Launcher2/LauncherWindow.cs @@ -116,7 +116,7 @@ namespace Launcher2 { } public void Run() { - Window = new NativeWindow( 640, 480, Program.AppName, 0, + Window = new NativeWindow( 640, 400, Program.AppName, 0, GraphicsMode.Default, DisplayDevice.Default ); Window.Visible = true; Drawer = new GdiPlusDrawer2D( null );