mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 11:06:06 -04:00
Touchup launcher a bit and make default height 40 pixels smaller, also fix clicking 'use sounds' multiple times causing the client to crash.
This commit is contained in:
parent
d7128d5bc7
commit
06b0562695
@ -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 );
|
||||
|
@ -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 ) {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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 ) {
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user