private static void RenderAutoComplete() { if (_suggestions.Count > 0) { var longestSuggestion = (from command in _suggestions orderby command.Length descending select command).First(); var size = FontManager.MeasureString(longestSuggestion); var x = _inputBoxRight; var y = _inputBoxBottom - 2; var lines = Math.Min(_suggestions.Count, 20); var h = (lines * 16) + 4 + 6; var w = size + 4 + 6; Renderer2D.FillRectangle(new Color(0x44, 0x44, 0x44), x, y, w, h); Renderer2D.DrawRectangle(new Color(0x22, 0x22, 0x22), x, y, w, h); foreach (var line in _suggestions) { FontManager.SetColor(Color.White); FontManager.PrintString(new Vector2(x + 5, y + 5), line); y += 16; } } }
private static void RenderOutputBox() { int x = 15; int y = _inputBoxBottom + 5; int w = _screenX - 30; int h = _screenY - y - 15 - 2; var size = 16; Renderer2D.FillRectangle(new Color(0x44, 0x44, 0x44, 0xcc), x, y, w + 2, h + 2); Renderer2D.DrawRectangle(new Color(0x22, 0x22, 0x22, 0xcc), x, y, w + 2, h + 2); bool reset = false; if (_screenSize == 0) { reset = true; } _screenSize = (h - 4) / 16; if (reset) { ResetTop(); } var list = _screenBuffer.Skip(_screenTop); int i = 0; y += 5; foreach (var line in list) { FontManager.SetColor(Color.White); FontManager.PrintString(new Vector2(x + 5, y), line); y += size; i++; if (i >= _screenSize) { break; } } }
public static void Process() { Vector3 delta = new Vector3(); if (_rightKey) { delta += new Vector3(3.0f * Game.DeltaTime, 0, 0); } if (_leftKey) { delta += new Vector3(-3.0f * Game.DeltaTime, 0, 0); } if (_upKey) { delta += new Vector3(0, 3.0f * Game.DeltaTime, 0); } if (_downKey) { delta += new Vector3(0, -3.0f * Game.DeltaTime, 0); } if (_inKey) { delta += new Vector3(0, 0, -3.0f * Game.DeltaTime); } if (_outKey) { delta += new Vector3(0, 0, 3.0f * Game.DeltaTime); } Camera.MainCamera.Position += delta; if (Camera.MainCamera.Position.X > 255) { Camera.MainCamera.Position = new Vector3(4.0f, 40.0f, 12.0f); } FontManager.SetColor(Color.White); FontManager.SetFont(FontStyle.Console); FontManager.PrintString(new Vector2(5f, 5f), string.Format("Position: ({0}, {1})", Camera.MainCamera.Position.X, Camera.MainCamera.Position.Y)); FontManager.PrintString(new Vector2(5f, 720f - 12f - 5f), string.Format("Client state: {0}", Client.State)); }
private static void RenderInputBox() { var text = "GBH2>^7 " + _inputBuffer; var tSize = FontManager.MeasureString(text); int x = 15; int y = 15; int w = _screenX - 30; int h = 16 + 3 + 3; Renderer2D.FillRectangle(new Color(0x44, 0x44, 0x44), x, y, w + 2, h + 2); Renderer2D.DrawRectangle(new Color(0x22, 0x22, 0x22), x, y, w + 2, h + 2); FontManager.SetColor(Color.Yellow); FontManager.PrintString(new Vector2(x + 7, y + 3), text); _inputBoxRight = x + 7 + tSize; _inputBoxBottom = y + h + 2; }