Can now press F1 to hide gui.

This commit is contained in:
UnknownShadow200 2015-09-11 19:39:48 +10:00
parent 1ec491d2a1
commit c714c5136a
5 changed files with 24 additions and 16 deletions

View file

@ -14,9 +14,11 @@ namespace ClassicalSharp {
TextWidget fpsTextWidget;
public override void Render( double delta ) {
graphicsApi.Texturing = true;
public override void Render( double delta ) {
UpdateFPS( delta );
if( game.HideGui ) return;
graphicsApi.Texturing = true;
fpsTextWidget.Render( delta );
graphicsApi.Texturing = false;
}

View file

@ -15,6 +15,7 @@ namespace ClassicalSharp {
Font playerFont;
public override void Render( double delta ) {
if( game.HideGui ) return;
graphicsApi.Texturing = true;
chat.Render( delta );
hotbar.Render( delta );

View file

@ -38,24 +38,24 @@ namespace ClassicalSharp {
titleFont = new Font( "Arial", 16, FontStyle.Bold );
keyStatusFont = new Font( "Arial", 13, FontStyle.Italic );
textFont = new Font( "Arial", 14, FontStyle.Bold );
controlsWidget = TextWidget.Create( game, 0, 30, "&eControls list", Docking.Centre, Docking.LeftOrTop, titleFont );
keyStatusWidget = TextWidget.Create( game, 0, 80, "", Docking.Centre, Docking.BottomOrRight, keyStatusFont );
gameWidget = TextWidget.Create( game, 0, 50, "&eBack to game", Docking.Centre, Docking.BottomOrRight, titleFont );
exitWidget = TextWidget.Create( game, 0, 10, "&eExit", Docking.Centre, Docking.BottomOrRight, titleFont );
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 );
string[] descriptionsLeft = { "Forward", "Back", "Left", "Right", "Jump", "Respawn", "Set spawn",
"Open chat", "Send chat", "Pause", "Open inventory" };
"Open chat", "Send chat", "Pause", "Open inventory", "Take screenshot" };
MakeKeys( KeyMapping.Forward, descriptionsLeft, 10, out keysLeft );
leftEnd = CalculateMaxWidth( keysLeft );
string[] descriptionsRight = { "Take screenshot", "Toggle fullscreen", "Toggle VSync", "Toggle 3rd person camera",
"Change view distance", "Toggle fly", "Speed", "Toggle noclip", "Fly up", "Fly down", "Display player list" };
MakeKeys( KeyMapping.Screenshot, descriptionsRight, leftEnd + 30, out keysRight );
string[] descriptionsRight = { "Toggle fullscreen", "Toggle VSync", "Toggle 3rd person camera", "Change view distance",
"Toggle fly", "Speed", "Toggle noclip", "Fly up", "Fly down", "Display player list", "Hide gui" };
MakeKeys( KeyMapping.Fullscreen, descriptionsRight, leftEnd + 30, out keysRight );
}
int leftEnd;
void MakeKeys( KeyMapping start, string[] descriptions, int offset, out KeyMapWidget[] widgets ) {
int startY = controlsWidget.BottomRight.Y + 10;
int startY = controlsWidget.BottomRight.Y + 5;
widgets = new KeyMapWidget[descriptions.Length];
for( int i = 0; i < widgets.Length; i++ ) {
@ -80,6 +80,8 @@ namespace ClassicalSharp {
exitWidget.Dispose();
for( int i = 0; i < keysLeft.Length; i++ ) {
keysLeft[i].Dispose();
}
for( int i = 0; i < keysRight.Length; i++ ) {
keysRight[i].Dispose();
}
}

View file

@ -90,6 +90,8 @@ namespace ClassicalSharp {
Key key = e.Key;
if( key == Key.F4 && ( IsKeyDown( Key.AltLeft ) || IsKeyDown( Key.AltRight ) ) ) {
Exit();
} else if( key == Keys[KeyMapping.HideGui] ) {
HideGui = !HideGui;
} else if( key == Keys[KeyMapping.Screenshot] ) {
screenshotRequested = true;
} else if( key == Keys[KeyMapping.Fullscreen] ) {
@ -190,8 +192,8 @@ namespace ClassicalSharp {
public enum KeyMapping {
Forward, Back, Left, Right, Jump, Respawn, SetSpawn, OpenChat,
SendChat, PauseOrExit, OpenInventory, Screenshot, Fullscreen, VSync,
ThirdPersonCamera, ViewDistance, Fly, Speed, NoClip, FlyUp, FlyDown,
PlayerList, ChatHistoryMode,
ThirdPersonCamera, ViewDistance, Fly, Speed, NoClip, FlyUp,
FlyDown, PlayerList, HideGui,
}
public class KeyMap {
@ -234,8 +236,8 @@ namespace ClassicalSharp {
Keys = new Key[] {
Key.W, Key.S, Key.A, Key.D, Key.Space, Key.R, Key.Y, Key.T,
Key.Enter, Key.Escape, Key.B, Key.F12, Key.F11, Key.F7,
Key.F5, Key.F6, Key.Z, Key.ShiftLeft, Key.X, Key.Q, Key.E,
Key.Tab, Key.H };
Key.F5, Key.F6, Key.Z, Key.ShiftLeft, Key.X, Key.Q,
Key.E, Key.Tab, Key.F1 };
#else
Keys = new Key[23];
Keys[0] = Key.W; Keys[1] = Key.S; Keys[2] = Key.A; Keys[3] = Key.D;
@ -244,7 +246,7 @@ namespace ClassicalSharp {
Keys[11] = Key.F12; Keys[12] = Key.F11; Keys[13] = Key.F7;
Keys[14] = Key.F5; Keys[15] = Key.F6; Keys[16] = Key.Z;
Keys[17] = Key.ShiftLeft; Keys[18] = Key.X; Keys[19] = Key.Q;
Keys[20] = Key.E; Keys[21] = Key.Tab; Keys[22] = Key.H;
Keys[20] = Key.E; Keys[21] = Key.Tab; Keys[22] = Key.F1;
#endif
}
}

View file

@ -99,6 +99,7 @@ namespace ClassicalSharp {
public AsyncDownloader AsyncDownloader;
public Matrix4 View, Projection;
public int MouseSensitivity = 30;
public bool HideGui = false;
void LoadAtlas( Bitmap bmp ) {
TerrainAtlas1D.Dispose();