/// <summary> /// Updates internal state of interface. /// </summary> /// <param name="gameTime"></param> public override void Update(GameTime gameTime) { console.Update(gameTime); testLayer.Color = UIConfig.LenaColor; /*if ( gameEngine.Keyboard.IsKeyDown(Keys.R) ) { * testLayer.Clear(); * testLayer.DrawDebugString( debugFont, 10, 276, rand.Next().ToString(), Color.White ); * } */ if (GameEngine.Keyboard.IsKeyDown(Keys.Left)) { angle -= 0.01f; } if (GameEngine.Keyboard.IsKeyDown(Keys.Right)) { angle += 0.01f; } testLayer.SetTransform(new Vector2(100, 0), new Vector2(128 + 5, 128 + 5), angle); }
/// <summary> /// /// </summary> /// <param name="gameTime"></param> public void Update(GameTime gameTime) { var vp = Game.GraphicsDevice.DisplayBounds; RefreshConsoleLayer(); if (isShown) { showFactor = MathUtil.Clamp(showFactor + FallSpeed * gameTime.ElapsedSec, 0, 1); } else { showFactor = MathUtil.Clamp(showFactor - FallSpeed * gameTime.ElapsedSec, 0, 1); } consoleLayer.Visible = showFactor > 0; //Log.Message("{0} {1}", showFactor, Show); float offset = (int)(-(vp.Height / 2 + 1) * (1 - showFactor)); consoleLayer.SetTransform(new Vector2(0, offset), Vector2.Zero, 0); editLayer.SetTransform(0, vp.Height / 2 - charHeight); Color cursorColor = CmdLineColor; cursorColor.A = (byte)(cursorColor.A * (0.5 + 0.5 * Math.Cos(2 * CursorBlinkRate * Math.PI * gameTime.Total.TotalSeconds) > 0.5 ? 1 : 0)); editLayer.Clear(); //consoleFont.DrawString( editLayer, "]" + editBox.Text, 0,0, Config.CmdLineColor ); //consoleFont.DrawString( editLayer, "_", charWidth + charWidth * editBox.Cursor, 0, cursorColor ); var text = "]" + editBox.Text; var color = CmdLineColor; DrawString(editLayer, charWidth / 2, -charHeight / 2, text, color); DrawString(editLayer, charWidth + charWidth / 2 + charWidth * editBox.Cursor, -charHeight / 2, "_", cursorColor); var version = Game.GetReleaseInfo(); DrawString(editLayer, vp.Width - charWidth / 2 - charWidth * version.Length, -charHeight - charHeight / 2, version, VersionColor); var frameRate = string.Format("fps = {0,7:0.00}", gameTime.Fps); DrawString(editLayer, vp.Width - charWidth / 2 - charWidth * frameRate.Length, -charHeight / 2, frameRate, VersionColor); // // Draw suggestions : // if (isShown && suggestion != null && suggestion.Candidates.Any()) { var candidates = suggestion.Candidates; var x = 0; var y = charHeight + 1; var w = (candidates.Max(s => s.Length) + 4) * charWidth; var h = (candidates.Count() + 1) * charHeight; w = Math.Max(w, charWidth * 16); editLayer.Draw(null, x, y, w, h, BackColor); int line = 0; foreach (var candidate in candidates) { DrawString(editLayer, x + charWidth + charWidth / 2, y + charHeight * line, candidate, HelpColor); line++; } } }