diff --git a/ClassicalSharp/2D/Screens/Menu/EnvSettingsScreen.cs b/ClassicalSharp/2D/Screens/Menu/EnvSettingsScreen.cs
index abd42acaa..0da43d986 100644
--- a/ClassicalSharp/2D/Screens/Menu/EnvSettingsScreen.cs
+++ b/ClassicalSharp/2D/Screens/Menu/EnvSettingsScreen.cs
@@ -55,7 +55,7 @@ namespace ClassicalSharp {
(g, v) => g.Map.SetWaterLevel( Int32.Parse( v ) ) ),
Make( 0, 5, "Back to menu", Docking.BottomOrRight,
- g => g.SetNewScreen( new NewPauseScreen( g ) ), null, null ),
+ g => g.SetNewScreen( new PauseScreen( g ) ), null, null ),
null,
};
diff --git a/ClassicalSharp/2D/Screens/Menu/KeyMappingsScreen.cs b/ClassicalSharp/2D/Screens/Menu/KeyMappingsScreen.cs
index 45bb5fe55..77edc88e9 100644
--- a/ClassicalSharp/2D/Screens/Menu/KeyMappingsScreen.cs
+++ b/ClassicalSharp/2D/Screens/Menu/KeyMappingsScreen.cs
@@ -25,7 +25,7 @@ namespace ClassicalSharp {
MakeKeys( KeyMapping.Forward, descriptionsLeft, -140 );
MakeKeys( KeyMapping.Screenshot, descriptionsRight, 140 );
- buttons[index] = Make( 0, 5, "Back to menu", Docking.BottomOrRight, g => g.SetNewScreen( new NewPauseScreen( g ) ) );
+ buttons[index] = Make( 0, 5, "Back to menu", Docking.BottomOrRight, g => g.SetNewScreen( new PauseScreen( g ) ) );
}
int index;
diff --git a/ClassicalSharp/2D/Screens/Menu/OptionsScreen.cs b/ClassicalSharp/2D/Screens/Menu/OptionsScreen.cs
index 8ff8d9824..cc0b7e931 100644
--- a/ClassicalSharp/2D/Screens/Menu/OptionsScreen.cs
+++ b/ClassicalSharp/2D/Screens/Menu/OptionsScreen.cs
@@ -28,7 +28,7 @@ namespace ClassicalSharp {
Make( -140, 50, "VSync active", Docking.Centre, OnWidgetClick,
g => g.VSync ? "yes" : "no",
- (g, v) => g.VSync = v == "yes" ),
+ (g, v) => g.Graphics.SetVSync( g, v == "yes" ) ),
Make( 140, -50, "Mouse sensitivity", Docking.Centre, OnWidgetClick,
g => g.MouseSensitivity.ToString(),
(g, v) => g.MouseSensitivity = Int32.Parse( v ) ),
@@ -43,7 +43,7 @@ namespace ClassicalSharp {
} ),
Make( 0, 5, "Back to menu", Docking.BottomOrRight,
- g => g.SetNewScreen( new NewPauseScreen( g ) ), null, null ),
+ g => g.SetNewScreen( new PauseScreen( g ) ), null, null ),
null,
};
validators = new MenuInputValidator[] {
diff --git a/ClassicalSharp/2D/Screens/Menu/NewPauseScreen.cs b/ClassicalSharp/2D/Screens/Menu/PauseScreen.cs
similarity index 83%
rename from ClassicalSharp/2D/Screens/Menu/NewPauseScreen.cs
rename to ClassicalSharp/2D/Screens/Menu/PauseScreen.cs
index b1a09b4be..308d6b46a 100644
--- a/ClassicalSharp/2D/Screens/Menu/NewPauseScreen.cs
+++ b/ClassicalSharp/2D/Screens/Menu/PauseScreen.cs
@@ -4,9 +4,9 @@ using OpenTK.Input;
namespace ClassicalSharp {
- public class NewPauseScreen : MenuScreen {
+ public class PauseScreen : MenuScreen {
- public NewPauseScreen( Game game ) : base( game ) {
+ public PauseScreen( Game game ) : base( game ) {
}
public override void Init() {
@@ -14,7 +14,7 @@ namespace ClassicalSharp {
buttons = new ButtonWidget[] {
Make( 0, -50, "Options", Docking.Centre, g => g.SetNewScreen( new OptionsScreen( g ) ) ),
Make( 0, 0, "Environment settings", Docking.Centre, g => g.SetNewScreen( new EnvSettingsScreen( g ) ) ),
- Make( 0, 50, "Key mappings", Docking.Centre, g => g.SetNewScreen( new KeyMappingsScreen( g ) ) ),
+ Make( 0, 50, "Key mappings", Docking.Centre, g => g.SetNewScreen( new OldPauseScreen( g ) ) ), // TODO: Temp fix
Make( 0, 55, "Back to game", Docking.BottomOrRight, g => g.SetNewScreen( new NormalScreen( g ) ) ),
Make( 0, 5, "Exit", Docking.BottomOrRight, g => g.Exit() ),
};
diff --git a/ClassicalSharp/2D/Screens/PauseScreen.cs b/ClassicalSharp/2D/Screens/OldPauseScreen.cs
similarity index 90%
rename from ClassicalSharp/2D/Screens/PauseScreen.cs
rename to ClassicalSharp/2D/Screens/OldPauseScreen.cs
index 2bad639df..f4b7c3859 100644
--- a/ClassicalSharp/2D/Screens/PauseScreen.cs
+++ b/ClassicalSharp/2D/Screens/OldPauseScreen.cs
@@ -4,12 +4,12 @@ using OpenTK.Input;
namespace ClassicalSharp {
- public class PauseScreen : Screen {
+ public class OldPauseScreen : Screen {
- public PauseScreen( Game game ) : base( game ) {
+ public OldPauseScreen( Game game ) : base( game ) {
}
- TextWidget controlsWidget, gameWidget, exitWidget, keyStatusWidget;
+ TextWidget controlsWidget, gameWidget, keyStatusWidget;
KeyMapWidget[] keysLeft, keysRight;
KeyMapWidget widgetToChange;
@@ -18,7 +18,6 @@ namespace ClassicalSharp {
graphicsApi.Texturing = true;
controlsWidget.Render( delta );
gameWidget.Render( delta );
- exitWidget.Render( delta );
keyStatusWidget.Render( delta );
for( int i = 0; i < keysLeft.Length; i++ ) {
keysLeft[i].Render( delta );
@@ -40,8 +39,7 @@ namespace ClassicalSharp {
textFont = new Font( "Arial", 14, FontStyle.Bold );
controlsWidget = TextWidget.Create( game, 0, 20, "&eControls list", Docking.Centre, Docking.LeftOrTop, titleFont );
keyStatusWidget = TextWidget.Create( game, 0, 70, "", Docking.Centre, Docking.BottomOrRight, keyStatusFont );
- gameWidget = TextWidget.Create( game, 0, 40, "&eBack to game", Docking.Centre, Docking.BottomOrRight, titleFont );
- exitWidget = TextWidget.Create( game, 0, 5, "&eExit", Docking.Centre, Docking.BottomOrRight, titleFont );
+ gameWidget = TextWidget.Create( game, 0, 40, "&eBack to menu", Docking.Centre, Docking.BottomOrRight, titleFont );
string[] descriptionsLeft = { "Forward", "Back", "Left", "Right", "Jump", "Respawn", "Set spawn",
"Open chat", "Send chat", "Pause", "Open inventory", "Take screenshot" };
@@ -75,7 +73,6 @@ namespace ClassicalSharp {
keyStatusWidget.Dispose();
gameWidget.Dispose();
controlsWidget.Dispose();
- exitWidget.Dispose();
for( int i = 0; i < keysLeft.Length; i++ ) {
keysLeft[i].Dispose();
}
@@ -87,7 +84,6 @@ namespace ClassicalSharp {
public override void OnResize( int oldWidth, int oldHeight, int width, int height ) {
gameWidget.OnResize( oldWidth, oldHeight, width, height );
controlsWidget.OnResize( oldWidth, oldHeight, width, height );
- exitWidget.OnResize( oldWidth, oldHeight, width, height );
keyStatusWidget.OnResize( oldWidth, oldHeight, width, height );
for( int i = 0; i < keysLeft.Length; i++ ) {
keysLeft[i].OnResize( oldWidth, oldHeight, width, height );
@@ -149,13 +145,9 @@ namespace ClassicalSharp {
}
public override bool HandlesMouseClick( int mouseX, int mouseY, MouseButton button ) {
- if( button != MouseButton.Left ) return false;
- if( exitWidget.ContainsPoint( mouseX, mouseY ) ) {
- game.Exit();
- return true;
- } else if( gameWidget.ContainsPoint( mouseX, mouseY ) ) {
- game.SetNewScreen( new NormalScreen( game ) );
- return true;
+ if( button != MouseButton.Left ) return true;
+ if( gameWidget.ContainsPoint( mouseX, mouseY ) ) {
+ game.SetNewScreen( new PauseScreen( game ) );
} else if( widgetToChange == null ) {
for( int i = 0; i < keysLeft.Length; i++ ) {
KeyMapWidget widget = keysLeft[i];
@@ -172,7 +164,7 @@ namespace ClassicalSharp {
}
}
}
- return false;
+ return true;
}
void SetWidgetToChange( KeyMapWidget widget ) {
diff --git a/ClassicalSharp/ClassicalSharp.csproj b/ClassicalSharp/ClassicalSharp.csproj
index ec4d073d7..b1b630fd8 100644
--- a/ClassicalSharp/ClassicalSharp.csproj
+++ b/ClassicalSharp/ClassicalSharp.csproj
@@ -75,10 +75,10 @@
-
+
-
+
diff --git a/ClassicalSharp/Commands/CommandManager.cs b/ClassicalSharp/Commands/CommandManager.cs
index fc6d1122b..59efaefe2 100644
--- a/ClassicalSharp/Commands/CommandManager.cs
+++ b/ClassicalSharp/Commands/CommandManager.cs
@@ -15,12 +15,8 @@ namespace ClassicalSharp.Commands {
this.game = game;
RegisterCommand( new CommandsCommand() );
RegisterCommand( new HelpCommand() );
- RegisterCommand( new EnvCommand() );
RegisterCommand( new InfoCommand() );
RegisterCommand( new RenderTypeCommand() );
- RegisterCommand( new ChatFontSizeCommand() );
- RegisterCommand( new MouseSensitivityCommand() );
- RegisterCommand( new ViewDistanceCommand() );
RegisterCommand( new TexturePackCommand() );
}
diff --git a/ClassicalSharp/Commands/DefaultCommands.cs b/ClassicalSharp/Commands/DefaultCommands.cs
index b8914a950..54acbbd0c 100644
--- a/ClassicalSharp/Commands/DefaultCommands.cs
+++ b/ClassicalSharp/Commands/DefaultCommands.cs
@@ -38,69 +38,6 @@ namespace ClassicalSharp.Commands {
}
}
- /// Command that modifies various aspects of the environment of the current map.
- public sealed class EnvCommand : Command {
-
- public EnvCommand() {
- Name = "Env";
- Help = new [] {
- "&a/client env [property] [value]",
- "&bproperties: &eskycol, fogcol, cloudscol, cloudsspeed,",
- " &esuncol, shadowcol, weather",
- "&bcol properties: &evalue must be a hex colour code (either #RRGGBB or RRGGBB).",
- "&bcloudsspeed: &evalue must be a decimal number. (e.g. 0.5, 1, 4.5).",
- "&eIf no args are given, the current env variables will be displayed.",
- };
- }
-
- public override void Execute( CommandReader reader ) {
- string property = reader.Next();
- if( property == null ) {
- game.AddChat( "Fog colour: " + game.Map.FogCol.ToRGBHexString() );
- game.AddChat( "Clouds colour: " + game.Map.CloudsCol.ToRGBHexString() );
- game.AddChat( "Sky colour: " + game.Map.SkyCol.ToRGBHexString() );
- } else if( Utils.CaselessEquals( property, "skycol" ) ) {
- ReadHexColourAnd( reader, c => game.Map.SetSkyColour( c ) );
- } else if( Utils.CaselessEquals( property, "fogcol" ) ) {
- ReadHexColourAnd( reader, c => game.Map.SetFogColour( c ) );
- } else if( Utils.CaselessEquals( property, "cloudscol" )
- || Utils.CaselessEquals( property, "cloudcol" ) ) {
- ReadHexColourAnd( reader, c => game.Map.SetCloudsColour( c ) );
- } else if( Utils.CaselessEquals( property, "suncol" ) ) {
- ReadHexColourAnd( reader, c => game.Map.SetSunlight( c ) );
- } else if( Utils.CaselessEquals( property, "shadowcol" ) ) {
- ReadHexColourAnd( reader, c => game.Map.SetShadowlight( c ) );
- } else if( Utils.CaselessEquals( property, "cloudsspeed" )
- || Utils.CaselessEquals( property, "cloudspeed" ) ) {
- float speed;
- if( !reader.NextFloat( out speed ) ) {
- game.AddChat( "&e/client env: &cInvalid clouds speed." );
- } else {
- StandardEnvRenderer env = game.EnvRenderer as StandardEnvRenderer;
- if( env != null ) {
- env.CloudsSpeed = speed;
- }
- }
- } else if( Utils.CaselessEquals( property, "weather" ) ) {
- int weather;
- if( !reader.NextInt( out weather ) || weather < 0 || weather > 2 ) {
- game.AddChat( "&e/client env: &cInvalid weather." );
- } else {
- game.Map.SetWeather( (Weather)weather );
- }
- }
- }
-
- void ReadHexColourAnd( CommandReader reader, Action action ) {
- FastColour colour;
- if( !reader.NextHexColour( out colour ) ) {
- game.AddChat( "&e/client env: &cInvalid hex colour." );
- } else {
- action( colour );
- }
- }
- }
-
/// Command that displays information about an input client command.
public sealed class HelpCommand : Command {
@@ -210,86 +147,6 @@ namespace ClassicalSharp.Commands {
}
}
- /// Command that modifies the font size of chat in the normal gui screen.
- public sealed class ChatFontSizeCommand : Command {
-
- public ChatFontSizeCommand() {
- Name = "ChatSize";
- Help = new [] {
- "&a/client chatsize [fontsize]",
- "&bfontsize: &eWhole number specifying the new font size for chat.",
- };
- }
-
- public override void Execute( CommandReader reader ) {
- int fontSize;
- if( !reader.NextInt( out fontSize ) ) {
- game.AddChat( "&e/client chatsize: &cInvalid font size." );
- } else {
- if( fontSize < 6 ) {
- game.AddChat( "&e/client chatsize: &cFont size too small." );
- return;
- } else if( fontSize > 30 ) {
- game.AddChat( "&e/client chatsize: &cFont size too big." );
- return;
- }
- game.ChatFontSize = fontSize;
- game.SetNewScreen( null );
- game.chatInInputBuffer = null;
- game.SetNewScreen( new NormalScreen( game ) );
- }
- }
- }
-
- /// Command that modifies how sensitive the client is to changes in the mouse position.
- public sealed class MouseSensitivityCommand : Command {
-
- public MouseSensitivityCommand() {
- Name = "Sensitivity";
- Help = new [] {
- "&a/client sensitivity [mouse sensitivity]",
- "&bmouse sensitivity: &eInteger between 1 to 100 specifiying the mouse sensitivity.",
- };
- }
-
- public override void Execute( CommandReader reader ) {
- int sensitivity;
- if( !reader.NextInt( out sensitivity ) ) {
- game.AddChat( "&e/client sensitivity: Current sensitivity is: " + game.MouseSensitivity );
- } else if( sensitivity < 1 || sensitivity > 100 ) {
- game.AddChat( "&e/client sensitivity: &cMouse sensitivity must be between 1 to 100." );
- } else {
- game.MouseSensitivity = sensitivity;
- }
- }
- }
-
- /// Command that modifies how far the client can see.
- public sealed class ViewDistanceCommand : Command {
-
- public ViewDistanceCommand() {
- Name = "ViewDistance";
- Help = new [] {
- "&a/client viewdistance [range]",
- "&brange: &eInteger specifying how far you can see before fog appears.",
- "&eThe minimum range is 8, the maximum is 4096.",
- };
- }
-
- public override void Execute( CommandReader reader ) {
- int newDist;
- if( !reader.NextInt( out newDist ) ) {
- game.AddChat( "View distance: " + game.ViewDistance );
- } else if( newDist < 8 ) {
- game.AddChat( "&e/client viewdistance: &cThat view distance is way too small." );
- } else if( newDist > 4096 ) {
- game.AddChat( "&e/client viewdistance: &cThat view distance is way too large." );
- } else {
- game.SetViewDistance( newDist );
- }
- }
- }
-
/// Command that changes the client's texture pack.
public sealed class TexturePackCommand : Command {
diff --git a/ClassicalSharp/Game/Game.InputHandling.cs b/ClassicalSharp/Game/Game.InputHandling.cs
index 085ae5bda..15b42532d 100644
--- a/ClassicalSharp/Game/Game.InputHandling.cs
+++ b/ClassicalSharp/Game/Game.InputHandling.cs
@@ -125,8 +125,6 @@ namespace ClassicalSharp {
SetViewDistance( viewDistances[0] );
} else if( key == Keys[KeyMapping.PauseOrExit] && !Map.IsNotLoaded ) {
SetNewScreen( new PauseScreen( this ) );
- } else if( key == Key.F9 && !Map.IsNotLoaded ) { // TODO: Temp gui debug
- SetNewScreen( new NewPauseScreen( this ) );
} else if( key == Keys[KeyMapping.OpenInventory] ) {
SetNewScreen( new BlockSelectScreen( this ) );
} else {