mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 02:56:09 -04:00
Offset launcher table a little bit (Thanks azmi2299), also fix issue with text field carets being too big when using a custom texture pack.
This commit is contained in:
parent
db930bbd66
commit
e72b8720a3
@ -9,7 +9,7 @@ namespace Launcher2 {
|
||||
|
||||
const int tableIndex = 4, searchIndex = 0, hashIndex = 1;
|
||||
Font boldInputFont, tableFont;
|
||||
const int tableY = 50;
|
||||
const int tableX = 10, tableY = 50;
|
||||
|
||||
public ClassiCubeServersScreen( LauncherWindow game ) : base( game, true ) {
|
||||
boldInputFont = new Font( "Arial", 14, FontStyle.Bold );
|
||||
@ -82,6 +82,7 @@ namespace Launcher2 {
|
||||
Resize();
|
||||
selectedWidget = widgets[searchIndex];
|
||||
InputClick( 0, 0 );
|
||||
lastClicked = lastInput;
|
||||
}
|
||||
|
||||
public override void Resize() {
|
||||
@ -115,7 +116,7 @@ namespace Launcher2 {
|
||||
void MakeTableWidget() {
|
||||
int tableHeight = Math.Max( game.Height - tableY - 50, 1 );
|
||||
FastColour col = LauncherTableWidget.backGridCol;
|
||||
drawer.Clear( col, 0, tableY, game.Width, tableHeight );
|
||||
drawer.Clear( col, tableX, tableY, game.Width - tableX, tableHeight );
|
||||
|
||||
if( widgets[tableIndex] != null ) {
|
||||
LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex];
|
||||
@ -127,10 +128,11 @@ namespace Launcher2 {
|
||||
LauncherTableWidget widget = new LauncherTableWidget( game );
|
||||
widget.CurrentIndex = 0;
|
||||
widget.SetEntries( game.Session.Servers );
|
||||
widget.Height = tableHeight;
|
||||
widget.DrawAt( drawer, tableFont, inputFont, inputFont,
|
||||
Anchor.LeftOrTop, Anchor.LeftOrTop, 0, tableY );
|
||||
|
||||
widget.Height = tableHeight;
|
||||
|
||||
widget.DrawAt( drawer, tableFont, inputFont, inputFont,
|
||||
Anchor.LeftOrTop, Anchor.LeftOrTop, tableX, tableY );
|
||||
widget.NeedRedraw = Resize;
|
||||
widget.SelectedChanged = SelectedChanged;
|
||||
widgets[widgetIndex++] = widget;
|
||||
|
@ -29,7 +29,7 @@ namespace Launcher2 {
|
||||
}
|
||||
|
||||
void SelectHeader( int mouseX, int mouseY ) {
|
||||
int x = 0;
|
||||
int x = X;
|
||||
for( int i = 0; i < ColumnWidths.Length; i++ ) {
|
||||
x += ColumnWidths[i] + 10;
|
||||
if( mouseX >= x - 8 && mouseX < x + 8 ) {
|
||||
@ -41,7 +41,7 @@ namespace Launcher2 {
|
||||
}
|
||||
|
||||
void TrySortColumns( int mouseX ) {
|
||||
int x = 0;
|
||||
int x = X;
|
||||
if( mouseX >= x && mouseX < x + ColumnWidths[0] - 10 ) {
|
||||
SortEntries( nameComp ); return;
|
||||
}
|
||||
@ -93,6 +93,7 @@ namespace Launcher2 {
|
||||
if( DraggingScrollbar ) {
|
||||
ScrollbarClick( y );
|
||||
} else if( DraggingColumn >= 0 ) {
|
||||
if( x >= Window.Width - 20 ) return;
|
||||
int col = DraggingColumn;
|
||||
ColumnWidths[col] += deltaX;
|
||||
Utils.Clamp( ref ColumnWidths[col], 20, Window.Width - 20 );
|
||||
|
@ -58,8 +58,8 @@ namespace Launcher2 {
|
||||
}
|
||||
|
||||
public int CurrentIndex, Count;
|
||||
public int[] ColumnWidths = { 340, 80, 80, 140 };
|
||||
public int[] DesiredColumnWidths = { 340, 80, 80, 140 };
|
||||
public int[] ColumnWidths = { 350, 65, 65, 140 };
|
||||
public int[] DesiredColumnWidths = { 350, 65, 65, 140 };
|
||||
int defaultInputHeight;
|
||||
|
||||
internal struct TableEntry {
|
||||
@ -82,6 +82,7 @@ namespace Launcher2 {
|
||||
DrawTextArgs args = new DrawTextArgs( "IMP", font, true );
|
||||
defaultInputHeight = drawer.MeasureSize( ref args ).Height;
|
||||
|
||||
Width = Window.Width - X;
|
||||
int x = X + 5;
|
||||
DrawGrid( drawer, font, titleFont );
|
||||
ResetEntries();
|
||||
@ -93,9 +94,7 @@ namespace Launcher2 {
|
||||
x += DrawColumn( drawer, true, font, titleFont, boldFont,
|
||||
"Uptime", ColumnWidths[2], x, e => e.Uptime ) + 5;
|
||||
x += DrawColumn( drawer, true, font, titleFont, boldFont,
|
||||
"Software", ColumnWidths[3], x, e => e.Software ) + 5;
|
||||
|
||||
Width = Window.Width;
|
||||
"Software", ColumnWidths[3], x, e => e.Software ) + 5;
|
||||
DrawScrollbar( drawer );
|
||||
}
|
||||
|
||||
@ -113,7 +112,7 @@ namespace Launcher2 {
|
||||
for( int i = CurrentIndex; i < Count; i++ ) {
|
||||
args = new DrawTextArgs( filter( usedEntries[i] ), font, true );
|
||||
if( i == SelectedIndex && !separator )
|
||||
drawer.Clear( foreGridCol, 0, y - 3, Width, defaultInputHeight + 4 );
|
||||
drawer.Clear( foreGridCol, X, y - 3, Width, defaultInputHeight + 4 );
|
||||
|
||||
if( !DrawColumnEntry( drawer, ref args, maxWidth, x, ref y, ref usedEntries[i] ) ) {
|
||||
maxIndex = i; break;
|
||||
@ -157,7 +156,7 @@ namespace Launcher2 {
|
||||
void DrawGrid( IDrawer2D drawer, Font font, Font titleFont ) {
|
||||
DrawTextArgs args = new DrawTextArgs( "I", titleFont, true );
|
||||
Size size = drawer.MeasureSize( ref args );
|
||||
drawer.Clear( LauncherSkin.BackgroundCol, 0, Y + size.Height + 5, Window.Width, 2 );
|
||||
drawer.Clear( LauncherSkin.BackgroundCol, X, Y + size.Height + 5, Width, 2 );
|
||||
headerStartY = Y;
|
||||
|
||||
headerEndY = Y + size.Height + 5;
|
||||
|
@ -172,12 +172,11 @@ namespace Launcher2 {
|
||||
Y + Height - 5, 10, 2 );
|
||||
} else {
|
||||
args.Text = text.Substring( 0, CaretPos );
|
||||
Size trimmedSize = drawer.MeasureChatSize( ref args );
|
||||
int trimmedWidth = drawer.MeasureChatSize( ref args ).Width;
|
||||
args.Text = new String( text[CaretPos], 1 );
|
||||
Size charSize = drawer.MeasureChatSize( ref args );
|
||||
int charWidth = drawer.MeasureChatSize( ref args ).Width;
|
||||
|
||||
drawer.Clear( FastColour.White, X + 5 + trimmedSize.Width,
|
||||
Y + Height - 5, charSize.Width, 2 );
|
||||
drawer.Clear( FastColour.White, X + 5 + trimmedWidth, Y + Height - 5, charWidth, 2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,12 @@ namespace Launcher2 {
|
||||
}
|
||||
}
|
||||
|
||||
bool useBitmappedFont;
|
||||
void ProcessZipEntry( string filename, byte[] data, ZipEntry entry ) {
|
||||
MemoryStream stream = new MemoryStream( data );
|
||||
Bitmap bmp = new Bitmap( stream );
|
||||
Drawer.SetFontBitmap( bmp );
|
||||
Drawer.UseBitmappedChat = !Options.GetBool( OptionsKey.ArialChatFont, false );
|
||||
useBitmappedFont = !Options.GetBool( OptionsKey.ArialChatFont, false );
|
||||
}
|
||||
|
||||
public void MakeBackground() {
|
||||
@ -46,6 +47,7 @@ namespace Launcher2 {
|
||||
drawer.SetBitmap( Framebuffer );
|
||||
ClearArea( 0, 0, Width, Height );
|
||||
|
||||
drawer.UseBitmappedChat = useBitmappedFont;
|
||||
DrawTextArgs args = new DrawTextArgs( "&eClassical&fSharp", logoFont, false );
|
||||
Size size = drawer.MeasureChatSize( ref args );
|
||||
int xStart = Width / 2 - size.Width / 2;
|
||||
@ -54,6 +56,7 @@ namespace Launcher2 {
|
||||
drawer.DrawChatText( ref args, xStart + 5, 20 + 5 );
|
||||
args.Text = "&eClassical&fSharp";
|
||||
drawer.DrawChatText( ref args, xStart, 20 );
|
||||
drawer.UseBitmappedChat = false;
|
||||
}
|
||||
Dirty = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user