mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 12:05:14 -04:00
Can now manually set whether the launcher background uses colours or terrain.png through options.txt (Thanks FabTheZen). Closes #140.
This commit is contained in:
parent
d8e8d32340
commit
c38718b3ba
@ -90,17 +90,18 @@ namespace Launcher {
|
|||||||
protected virtual void MakeOtherWidgets() { }
|
protected virtual void MakeOtherWidgets() { }
|
||||||
|
|
||||||
void ModeClick( bool classic, bool classicHacks ) {
|
void ModeClick( bool classic, bool classicHacks ) {
|
||||||
game.ClassicMode = classic;
|
game.ClassicBackground = classic;
|
||||||
Options.Load();
|
Options.Load();
|
||||||
Options.Set( "mode-classic", game.ClassicMode );
|
Options.Set( "mode-classic", classic );
|
||||||
if( classic )
|
if( classic )
|
||||||
Options.Set( "nostalgia-hacks", classicHacks );
|
Options.Set( "nostalgia-hacks", classicHacks );
|
||||||
|
|
||||||
Options.Set( "nostalgia-customblocks", !game.ClassicMode );
|
Options.Set( "nostalgia-classicbg", classic );
|
||||||
Options.Set( "nostalgia-usecpe", !game.ClassicMode );
|
Options.Set( "nostalgia-customblocks", !classic );
|
||||||
Options.Set( "nostalgia-servertextures", !game.ClassicMode );
|
Options.Set( "nostalgia-usecpe", !classic );
|
||||||
Options.Set( "nostalgia-classictablist", game.ClassicMode );
|
Options.Set( "nostalgia-servertextures", !classic );
|
||||||
Options.Set( "nostalgia-classicoptions", game.ClassicMode );
|
Options.Set( "nostalgia-classictablist", classic );
|
||||||
|
Options.Set( "nostalgia-classicoptions", classic );
|
||||||
Options.Set( "nostalgia-classicgui", true );
|
Options.Set( "nostalgia-classicgui", true );
|
||||||
Options.Save();
|
Options.Save();
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ namespace Launcher {
|
|||||||
int tableHeight = Math.Max( game.Height - tableY - 50, 1 );
|
int tableHeight = Math.Max( game.Height - tableY - 50, 1 );
|
||||||
Rectangle rec = new Rectangle( tableX, tableY, game.Width - tableX, tableHeight );
|
Rectangle rec = new Rectangle( tableX, tableY, game.Width - tableX, tableHeight );
|
||||||
|
|
||||||
if( !game.ClassicMode ) {
|
if( !game.ClassicBackground ) {
|
||||||
FastColour col = LauncherTableWidget.backGridCol;
|
FastColour col = LauncherTableWidget.backGridCol;
|
||||||
Drawer2DExt.FastClear( dst, rec, col );
|
Drawer2DExt.FastClear( dst, rec, col );
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,7 +70,7 @@ namespace Launcher {
|
|||||||
Anchor.Centre, Anchor.Centre, 0, 110,
|
Anchor.Centre, Anchor.Centre, 0, 110,
|
||||||
(x, y) => Client.Start( widgets[0].Text, ref game.ShouldExit ) );
|
(x, y) => Client.Start( widgets[0].Text, ref game.ShouldExit ) );
|
||||||
|
|
||||||
if( !game.ClassicMode ) {
|
if( !game.ClassicBackground ) {
|
||||||
MakeButtonAt( "Colours", 110, buttonHeight, buttonFont,
|
MakeButtonAt( "Colours", 110, buttonHeight, buttonFont,
|
||||||
Anchor.LeftOrTop, Anchor.BottomOrRight, 10, -10,
|
Anchor.LeftOrTop, Anchor.BottomOrRight, 10, -10,
|
||||||
(x, y) => game.SetScreen( new ColoursScreen( game ) ) );
|
(x, y) => game.SetScreen( new ColoursScreen( game ) ) );
|
||||||
|
@ -120,7 +120,7 @@ namespace Launcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( separator && !Window.ClassicMode )
|
if( separator && !Window.ClassicBackground )
|
||||||
drawer.Clear( LauncherSkin.BackgroundCol, x - 7, Y, 2, Height );
|
drawer.Clear( LauncherSkin.BackgroundCol, x - 7, Y, 2, Height );
|
||||||
return maxWidth + 5;
|
return maxWidth + 5;
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ namespace Launcher {
|
|||||||
void DrawGrid( IDrawer2D drawer, Font font, Font titleFont ) {
|
void DrawGrid( IDrawer2D drawer, Font font, Font titleFont ) {
|
||||||
DrawTextArgs args = new DrawTextArgs( "I", titleFont, true );
|
DrawTextArgs args = new DrawTextArgs( "I", titleFont, true );
|
||||||
Size size = drawer.MeasureSize( ref args );
|
Size size = drawer.MeasureSize( ref args );
|
||||||
if( !Window.ClassicMode )
|
if( !Window.ClassicBackground )
|
||||||
drawer.Clear( LauncherSkin.BackgroundCol, X, Y + size.Height + 5, Width, 2 );
|
drawer.Clear( LauncherSkin.BackgroundCol, X, Y + size.Height + 5, Width, 2 );
|
||||||
headerStartY = Y;
|
headerStartY = Y;
|
||||||
|
|
||||||
@ -168,11 +168,11 @@ namespace Launcher {
|
|||||||
|
|
||||||
int maxIndex;
|
int maxIndex;
|
||||||
void DrawScrollbar( IDrawer2D drawer ) {
|
void DrawScrollbar( IDrawer2D drawer ) {
|
||||||
FastColour col = Window.ClassicMode ? new FastColour( 80, 80, 80 ) : LauncherSkin.ButtonBorderCol;
|
FastColour col = Window.ClassicBackground ? new FastColour( 80, 80, 80 ) : LauncherSkin.ButtonBorderCol;
|
||||||
drawer.Clear( col, Window.Width - 10, Y, 10, Height );
|
drawer.Clear( col, Window.Width - 10, Y, 10, Height );
|
||||||
float scale = Height / (float)Count;
|
float scale = Height / (float)Count;
|
||||||
|
|
||||||
col = Window.ClassicMode ? new FastColour( 160, 160, 160 ) : LauncherSkin.ButtonForeActiveCol;
|
col = Window.ClassicBackground ? new FastColour( 160, 160, 160 ) : LauncherSkin.ButtonForeActiveCol;
|
||||||
int y1 = (int)(Y + CurrentIndex * scale);
|
int y1 = (int)(Y + CurrentIndex * scale);
|
||||||
int height = (int)((maxIndex - CurrentIndex) * scale);
|
int height = (int)((maxIndex - CurrentIndex) * scale);
|
||||||
drawer.Clear( col, Window.Width - 10, y1, 10, height + 1 );
|
drawer.Clear( col, Window.Width - 10, y1, 10, height + 1 );
|
||||||
|
@ -35,7 +35,7 @@ namespace Launcher {
|
|||||||
DrawTextArgs args = new DrawTextArgs( text, font, true );
|
DrawTextArgs args = new DrawTextArgs( text, font, true );
|
||||||
|
|
||||||
DrawBorder( drawer );
|
DrawBorder( drawer );
|
||||||
if( Window.ClassicMode )
|
if( Window.ClassicBackground )
|
||||||
DrawClassic( drawer, xOffset, yOffset );
|
DrawClassic( drawer, xOffset, yOffset );
|
||||||
else
|
else
|
||||||
DrawNormal( drawer, xOffset, yOffset );
|
DrawNormal( drawer, xOffset, yOffset );
|
||||||
@ -44,7 +44,7 @@ namespace Launcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DrawBorder( IDrawer2D drawer ) {
|
void DrawBorder( IDrawer2D drawer ) {
|
||||||
FastColour backCol = Window.ClassicMode ? FastColour.Black : LauncherSkin.ButtonBorderCol;
|
FastColour backCol = Window.ClassicBackground ? FastColour.Black : LauncherSkin.ButtonBorderCol;
|
||||||
drawer.Clear( backCol, X + 1, Y, Width - 2, border );
|
drawer.Clear( backCol, X + 1, Y, Width - 2, border );
|
||||||
drawer.Clear( backCol, X + 1, Y + Height - border, Width - 2, border );
|
drawer.Clear( backCol, X + 1, Y + Height - border, Width - 2, border );
|
||||||
drawer.Clear( backCol, X, Y + 1, border, Height - 2 );
|
drawer.Clear( backCol, X, Y + 1, border, Height - 2 );
|
||||||
@ -72,7 +72,7 @@ namespace Launcher {
|
|||||||
public void RedrawBackground( FastBitmap dst ) {
|
public void RedrawBackground( FastBitmap dst ) {
|
||||||
if( Window.Minimised ) return;
|
if( Window.Minimised ) return;
|
||||||
Rectangle rect = new Rectangle( X + border, Y + border, Width - border * 2, Height - border * 2 );
|
Rectangle rect = new Rectangle( X + border, Y + border, Width - border * 2, Height - border * 2 );
|
||||||
if( Window.ClassicMode ) {
|
if( Window.ClassicBackground ) {
|
||||||
FastColour foreCol = Active ? new FastColour( 126, 136, 191 ) : new FastColour( 111, 111, 111 );
|
FastColour foreCol = Active ? new FastColour( 126, 136, 191 ) : new FastColour( 111, 111, 111 );
|
||||||
Drawer2DExt.DrawNoise( dst, rect, foreCol, 8 );
|
Drawer2DExt.DrawNoise( dst, rect, foreCol, 8 );
|
||||||
} else {
|
} else {
|
||||||
|
@ -9,12 +9,16 @@ namespace Launcher {
|
|||||||
|
|
||||||
public sealed partial class LauncherWindow {
|
public sealed partial class LauncherWindow {
|
||||||
|
|
||||||
internal bool ClassicMode = false;
|
internal bool ClassicBackground = false;
|
||||||
|
|
||||||
internal void TryLoadTexturePack() {
|
internal void TryLoadTexturePack() {
|
||||||
Options.Load();
|
Options.Load();
|
||||||
LauncherSkin.LoadFromOptions();
|
LauncherSkin.LoadFromOptions();
|
||||||
ClassicMode = Options.GetBool( "mode-classic", false );
|
if( Options.Get( "nostalgia-classicbg" ) != null )
|
||||||
|
ClassicBackground = Options.GetBool( "nostalgia-classicbg", false );
|
||||||
|
else
|
||||||
|
ClassicBackground = Options.GetBool( "mode-classic", false );
|
||||||
|
|
||||||
string texDir = Path.Combine( Program.AppDirectory, "texpacks" );
|
string texDir = Path.Combine( Program.AppDirectory, "texpacks" );
|
||||||
string texPack = Options.Get( OptionsKey.DefaultTexturePack ) ?? "default.zip";
|
string texPack = Options.Get( OptionsKey.DefaultTexturePack ) ?? "default.zip";
|
||||||
texPack = Path.Combine( texDir, texPack );
|
texPack = Path.Combine( texDir, texPack );
|
||||||
@ -62,7 +66,7 @@ namespace Launcher {
|
|||||||
Framebuffer = new Bitmap( Width, Height );
|
Framebuffer = new Bitmap( Width, Height );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ClassicMode ) {
|
if( ClassicBackground ) {
|
||||||
using( FastBitmap dst = new FastBitmap( Framebuffer, true ) ) {
|
using( FastBitmap dst = new FastBitmap( Framebuffer, true ) ) {
|
||||||
ClearTile( 0, 0, Width, 48, elemSize, 128, 64, dst );
|
ClearTile( 0, 0, Width, 48, elemSize, 128, 64, dst );
|
||||||
ClearTile( 0, 48, Width, Height - 48, 0, 96, 96, dst );
|
ClearTile( 0, 48, Width, Height - 48, 0, 96, 96, dst );
|
||||||
@ -94,7 +98,7 @@ namespace Launcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void ClearArea( int x, int y, int width, int height, FastBitmap dst ) {
|
public void ClearArea( int x, int y, int width, int height, FastBitmap dst ) {
|
||||||
if( ClassicMode ) {
|
if( ClassicBackground ) {
|
||||||
ClearTile( x, y, width, height, 0, 96, 96, dst );
|
ClearTile( x, y, width, height, 0, 96, 96, dst );
|
||||||
} else {
|
} else {
|
||||||
FastColour col = LauncherSkin.BackgroundCol;
|
FastColour col = LauncherSkin.BackgroundCol;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user