mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05: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
6 changed files with 25 additions and 20 deletions
|
@ -90,17 +90,18 @@ namespace Launcher {
|
|||
protected virtual void MakeOtherWidgets() { }
|
||||
|
||||
void ModeClick( bool classic, bool classicHacks ) {
|
||||
game.ClassicMode = classic;
|
||||
game.ClassicBackground = classic;
|
||||
Options.Load();
|
||||
Options.Set( "mode-classic", game.ClassicMode );
|
||||
Options.Set( "mode-classic", classic );
|
||||
if( classic )
|
||||
Options.Set( "nostalgia-hacks", classicHacks );
|
||||
|
||||
Options.Set( "nostalgia-customblocks", !game.ClassicMode );
|
||||
Options.Set( "nostalgia-usecpe", !game.ClassicMode );
|
||||
Options.Set( "nostalgia-servertextures", !game.ClassicMode );
|
||||
Options.Set( "nostalgia-classictablist", game.ClassicMode );
|
||||
Options.Set( "nostalgia-classicoptions", game.ClassicMode );
|
||||
Options.Set( "nostalgia-classicbg", classic );
|
||||
Options.Set( "nostalgia-customblocks", !classic );
|
||||
Options.Set( "nostalgia-usecpe", !classic );
|
||||
Options.Set( "nostalgia-servertextures", !classic );
|
||||
Options.Set( "nostalgia-classictablist", classic );
|
||||
Options.Set( "nostalgia-classicoptions", classic );
|
||||
Options.Set( "nostalgia-classicgui", true );
|
||||
Options.Save();
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace Launcher {
|
|||
int tableHeight = Math.Max( game.Height - tableY - 50, 1 );
|
||||
Rectangle rec = new Rectangle( tableX, tableY, game.Width - tableX, tableHeight );
|
||||
|
||||
if( !game.ClassicMode ) {
|
||||
if( !game.ClassicBackground ) {
|
||||
FastColour col = LauncherTableWidget.backGridCol;
|
||||
Drawer2DExt.FastClear( dst, rec, col );
|
||||
} else {
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace Launcher {
|
|||
Anchor.Centre, Anchor.Centre, 0, 110,
|
||||
(x, y) => Client.Start( widgets[0].Text, ref game.ShouldExit ) );
|
||||
|
||||
if( !game.ClassicMode ) {
|
||||
if( !game.ClassicBackground ) {
|
||||
MakeButtonAt( "Colours", 110, buttonHeight, buttonFont,
|
||||
Anchor.LeftOrTop, Anchor.BottomOrRight, 10, -10,
|
||||
(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 );
|
||||
return maxWidth + 5;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ namespace Launcher {
|
|||
void DrawGrid( IDrawer2D drawer, Font font, Font titleFont ) {
|
||||
DrawTextArgs args = new DrawTextArgs( "I", titleFont, true );
|
||||
Size size = drawer.MeasureSize( ref args );
|
||||
if( !Window.ClassicMode )
|
||||
if( !Window.ClassicBackground )
|
||||
drawer.Clear( LauncherSkin.BackgroundCol, X, Y + size.Height + 5, Width, 2 );
|
||||
headerStartY = Y;
|
||||
|
||||
|
@ -168,11 +168,11 @@ namespace Launcher {
|
|||
|
||||
int maxIndex;
|
||||
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 );
|
||||
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 height = (int)((maxIndex - CurrentIndex) * scale);
|
||||
drawer.Clear( col, Window.Width - 10, y1, 10, height + 1 );
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace Launcher {
|
|||
DrawTextArgs args = new DrawTextArgs( text, font, true );
|
||||
|
||||
DrawBorder( drawer );
|
||||
if( Window.ClassicMode )
|
||||
if( Window.ClassicBackground )
|
||||
DrawClassic( drawer, xOffset, yOffset );
|
||||
else
|
||||
DrawNormal( drawer, xOffset, yOffset );
|
||||
|
@ -44,7 +44,7 @@ namespace Launcher {
|
|||
}
|
||||
|
||||
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 + Height - border, Width - 2, border );
|
||||
drawer.Clear( backCol, X, Y + 1, border, Height - 2 );
|
||||
|
@ -72,7 +72,7 @@ namespace Launcher {
|
|||
public void RedrawBackground( FastBitmap dst ) {
|
||||
if( Window.Minimised ) return;
|
||||
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 );
|
||||
Drawer2DExt.DrawNoise( dst, rect, foreCol, 8 );
|
||||
} else {
|
||||
|
|
|
@ -9,12 +9,16 @@ namespace Launcher {
|
|||
|
||||
public sealed partial class LauncherWindow {
|
||||
|
||||
internal bool ClassicMode = false;
|
||||
internal bool ClassicBackground = false;
|
||||
|
||||
internal void TryLoadTexturePack() {
|
||||
Options.Load();
|
||||
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 texPack = Options.Get( OptionsKey.DefaultTexturePack ) ?? "default.zip";
|
||||
texPack = Path.Combine( texDir, texPack );
|
||||
|
@ -62,7 +66,7 @@ namespace Launcher {
|
|||
Framebuffer = new Bitmap( Width, Height );
|
||||
}
|
||||
|
||||
if( ClassicMode ) {
|
||||
if( ClassicBackground ) {
|
||||
using( FastBitmap dst = new FastBitmap( Framebuffer, true ) ) {
|
||||
ClearTile( 0, 0, Width, 48, elemSize, 128, 64, 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 ) {
|
||||
if( ClassicMode ) {
|
||||
if( ClassicBackground ) {
|
||||
ClearTile( x, y, width, height, 0, 96, 96, dst );
|
||||
} else {
|
||||
FastColour col = LauncherSkin.BackgroundCol;
|
||||
|
|
Loading…
Reference in a new issue