//Updates the number of collected items. public virtual void Update(GameTime gameTime) { string counter = String.Format("{0}", Stomper.Counter); InventoryCounterText = new Text(counter, false, (int)this.ItemPicture.Position.X - DistanceBetweenCounterAndPicture, (int)this.ItemPicture.Position.Y - DistanceBetweenCounterAndPicture, 1, 1, 0, Color.Brown, false, Constant.NameFontPath); InventoryCounterText.Update(gameTime, false); }
public Control(Game game, string text) { this.game = game; textTexture = new Text(game.ClientSize, new Size(0, 0), new Point(0, 0)); textTexture.Update(text); this.text = text; }
public string Change() { _text.TextValue += " changed"; _text.Update(); return(_text.TextValue); }
public Control(Game game) { this.game = game; textTexture = new Text(game.ClientSize, new Size(0, 0), new Point(0, 0)); textTexture.Update(""); this.text = ""; }
private void refresh() { //todo show some animation during this transitioning = true; songNameList.Clear(); SongLibrary.cacheSongInfo(); //prob should make separate method since searching forces cache refresh lol. we are good coders dont worry foreach (var pair in SongLibrary.songInfos) { Text temp = new Text(Config.ClientSize, new Size(550, 35), new Point(0, 0)); /*SizeF temp1 = temp.getStringSize(pair.Value.Artist + " - " + pair.Value.SongName); * temp.TextureSize = new Size((int)temp1.Width, (int)temp1.Height);*/ temp.Update(pair.Value.Artist + " - " + pair.Value.SongName); temp.Shadow = true; SelectComponent sc = new SelectComponent(game, new Rectangle(-50, 0, 550, 90), pair.Value.Artist, pair.Value.SongName); sc.clickEvent += new Action <int, SelectComponent>(sc_clickEvent); SongPair sp = new SongPair(sc, pair.Value); songNameList.Add(sp); sc.index = songNameList.IndexOf(sp); } songNameList.Sort(new Comparison <SongPair>(delegate(SongPair f, SongPair j) { return(-f.Info.SongName.CompareTo(j.Info.SongName)); })); foreach (SongPair sp in songNameList) { sp.select.index = songNameList.IndexOf(sp); } }
void UpdatePerformance() { textPerformance.String = ""; if (showPerformance == 1) { textPerformance.String = game.Framerate.ToString("00.0") + " FPS"; } else if (showPerformance == 2) { textPerformance.String = game.Framerate.ToString("00.0") + " FPS " + game.AverageFramerate.ToString("00.0") + " AVG"; } else if (showPerformance == 3) { textPerformance.String = game.Framerate.ToString("00.0") + " FPS " + game.AverageFramerate.ToString("00.0") + " AVG"; textPerformance.String += "\nUpdate " + game.UpdateCount.ToString("0000") + " Entities"; textPerformance.String += "\nRender " + game.RenderCount.ToString("0000") + " Renders"; } else if (showPerformance == 4) { textPerformance.String = game.Framerate.ToString("00.0") + " FPS " + game.AverageFramerate.ToString("00.0") + " AVG " + game.RealDeltaTime.ToString("0") + "ms"; textPerformance.String += "\nUpdate " + game.UpdateTime.ToString("00") + "ms (" + game.UpdateCount.ToString("0000") + " Entities)"; textPerformance.String += "\nRender " + game.RenderTime.ToString("00") + "ms (" + game.RenderCount.ToString("0000") + " Renders)"; } else if (showPerformance >= 5) { textPerformance.String = game.Framerate.ToString("00.0") + " FPS " + game.AverageFramerate.ToString("00.0") + " AVG " + game.RealDeltaTime.ToString("0") + "ms " + (GC.GetTotalMemory(false) / 1024 / 1024).ToString("00") + "MB"; textPerformance.String += "\nUpdate " + game.UpdateTime.ToString("00") + "ms (" + game.UpdateCount.ToString("0000") + " Entities)"; textPerformance.String += "\nRender " + game.RenderTime.ToString("00") + "ms (" + game.RenderCount.ToString("0000") + " Renders)"; } textPerformance.Update(); textPerformance.Y = 0; textPerformance.X = renderSurface.Width - textPerformance.Width; }
public override void Update() { base.Update(); ScoreText.String = ((int)Global.Score).ToString() + " B: " + Global.Bombs.ToString(); ScoreText.Update(); Global.theMusic.Pitch = Global.Score / 100; if (Global.Score < 0) { //GAME OVER Global.theGhost.RemoveSelf(); theFloor.gfx.Frame = 1; } if (Global.theController.Start.Pressed) { Global.theMusic.Stop(); Global.theMusic.Dispose(); Global.Score = 100; Global.Bombs = 3; Global.theGame.RemoveScene(); Global.theGame.AddScene(new GameState()); } if (Global.theController.A.Pressed) { GetReady(); } if (Global.Score > ScoreThreshNewBomb) { Global.Bombs++; ScoreThreshNewBomb += 100; } }
public Control(Game game, Rectangle bounds, string text) { this.game = game; this.bounds = bounds; textTexture = new Text(game.ClientSize, new Size(bounds.Width, bounds.Height), new Point(bounds.X, bounds.Y)); textTexture.Update(text); this.Text = text; }
public override void Render(DeviceContext deviceContext, Matrix viewMatrix, Matrix projectionMatrix) { _text.Content = ((int)_fpsCounter.Value) + " FPS | " + String.Format("{0:0.00}", _cpuUsageCounter.Value) + " % CPU | " + _videoCardInfo; _text.Update(deviceContext); _overlay.Size = new Vector2I(_text.Width + 2, 16); _overlay.Render(deviceContext, Matrix.Identity, viewMatrix, projectionMatrix); _text.Render(deviceContext, Matrix.Identity, viewMatrix, projectionMatrix); }
public SelectComponent(Game game, Rectangle bounds, string text, string line2) : base(game, bounds, text) { line = line2; lineTwo = new Text(Config.ClientSize, new Size(bounds.Width, bounds.Height), new Point(bounds.X, bounds.Y)); lineTwo.Update(line); OnLoad(null); baseX = bounds.X; }
public override void Update(GameTime gameTime) { base.Update(gameTime); if (inputManager.RectangleWasJustClicked(this.Rectangle)) { OnClick?.Invoke(this, new EventArgs()); } message?.Update(gameTime); }
public void Update(GameTime gameTime) { logo.Update(gameTime); levelText.Update(gameTime); levelNumber.Update(gameTime); caveText.Update(gameTime); caveNumber.Update(gameTime); playText.Update(gameTime); }
protected override void OnUpdate(float dt) { base.OnUpdate(dt); m_iconBorder.Update(dt); m_titleCover.Update(dt); m_titleCover2.Update(dt); m_icon.Update(dt); m_title.Update(dt); m_info.Update(dt); m_actionButton.Update(dt); bool actionHover = m_action != CampaignThumbnailAction.None && Screen.ModalDialog == Parent && Screen.MousePosition.X >= m_actionButton.Position.X && Screen.MousePosition.X < m_actionButton.Position.X + m_actionButton.Width && Screen.MousePosition.Y >= m_actionButton.Position.Y && Screen.MousePosition.Y < m_actionButton.Position.Y + m_actionButton.Height; if (actionHover != m_actionHover) { m_actionHover = actionHover; RequestRebuild(); if (m_actionHover) { PlayHighlightSound(); } } if (Highlight && Screen.ModalDialog == Parent) { if (Screen.CheckSelect()) { FireOnClicked(); PlaySelectSound(); } else if (Screen.CheckAltSelect() && m_action != CampaignThumbnailAction.None) { FireOnActionClicked(); PlaySelectSound(); } else if (Screen.Mouse.Buttons[MouseButton.Left].Pressed) { Screen.InputMethod = InputMethod.Mouse; if (m_actionHover) { FireOnActionClicked(); } else { FireOnClicked(); } PlaySelectSound(); } } }
public void CreateOrUpdate(Text txt) { if (txt.IsCreated) { txt.Update(); } else { txt.Create(); } }
public override void Render(DeviceContext deviceContext, Matrix viewMatrix, Matrix projectionMatrix) { _overlay.Render(deviceContext); _shader.Render(deviceContext, _overlay.IndexCount, Matrix.Translation(new Vector3(_position.X - 20, -_position.Y + 20, 0.0f)), viewMatrix, projectionMatrix, _overlay.Texture, _color); _distanceText.Update(deviceContext); _distanceText.Render(deviceContext, Matrix.Translation(new Vector3(_position.X - _distanceText.Width / 2, -_position.Y - 20, 0.0f)), viewMatrix, projectionMatrix); _nameText.Render(deviceContext, Matrix.Translation(new Vector3(_position.X + 22, -_position.Y + 15, 0.0f)), viewMatrix, projectionMatrix); _modelNameText.Render(deviceContext, Matrix.Translation(new Vector3(_position.X + 22, -_position.Y, 0.0f)), viewMatrix, projectionMatrix); }
public UserDisplay(User u, Point location) { this.u = u; back.Bounds = new Rectangle(location, new Size(back.Bounds.Width, back.Bounds.Height)); front.Bounds = new Rectangle(location.X + 2, location.Y + 2, front.Bounds.Width, front.Bounds.Height); back.Colour = new Color4(0.6f, 0.6f, 0.6f, 0.9f); front.Colour = new Color4(0.6f, 0.6f, 0.6f, 0.8f); Thread t = new Thread(new ParameterizedThreadStart(downloadThread)); wc = new WebClient(); t.IsBackground = true; t.Start(u.Avatar); name = new Text(new Size(118, 200), new Point(location.X + 90, location.Y + 2)); name.Shadow = false; name.Update(u.RealName); playCount = new Text(new Size(300, 300), new Point(location.X + 90, location.Y + 35)); playCount.Shadow = false; playCount.textFont = new Font("Myriad Pro", 14); playCount.Line = ("PC: " + u.Playcount + "\nScore: " + u.TotalScore + "\nLevel: " + u.Level); b = new Button(Game.game, new Rectangle(playCount.Location, new Size(100, 30)), "PM", delegate(int e) { Game.pbox.addTab("pulse|" + u.RealName); }); b2 = new Button(Game.game, new Rectangle(playCount.Location, new Size(100, 30)), "Spec", delegate(int e) { if (!Config.Spectating) { if (!u.Name.ToLower().Equals(Account.currentAccount.AccountName.ToLower())) { Client.PacketWriter.sendSpectateHook(Game.conn.Bw, u.Name); Game.pbox.addLine("Spectating " + u.Name + " (if they are online)"); } else { Game.pbox.addLine("You can't spectate yourself"); } } else { if (!Config.SpectatedUser.Equals("")) { Game.pbox.addLine("Canceling spectate on " + Config.SpectatedUser); } Client.PacketWriter.sendSpectateCancel(Game.conn.Bw, Config.SpectatedUser); Config.SpectatedUser = ""; Config.Spectating = false; } }); if (u.avatarRect != null) { avatar = u.avatarRect; } }
public virtual void Update(double deltaTime) { for (int index = 0; index < transformations.Count(); index++) { if (!transformations[index].Enabled) { transformations.RemoveAt(index); continue; } transformations[index].Transform(this as ITransformable, deltaTime); } if (Text != null) { Text.Update(deltaTime); } }
public void Update(GameTime gameTime) { guiText.Update(gameTime); map.Update(gameTime); Camera.Update(gameTime); timer = (timer >= 100) ? 0 : timer + gameTime.ElapsedGameTime.TotalMilliseconds; if (timer == 0) { if (map.DiamondsRequired > map.DiamondsCollected) { guiText.String = $"[{map.DiamondsRequired}]/{map.DiamondValue} [{map.DiamondsCollected}] {map.Time} {map.Score}"; } else { guiText.String = $"///{map.BonusDiamondValue} [{map.DiamondsCollected}] {map.Time} {map.Score}"; } } }
protected override void OnUpdate(float dt) { base.OnUpdate(dt); m_text.Update(dt); if (Highlight && Screen.ModalDialog == Parent) { if (Screen.CheckSelect()) { FireOnClicked(); PlaySelectSound(); } else if (Screen.Mouse.Buttons[MouseButton.Left].Pressed) { Screen.InputMethod = InputMethod.Mouse; FireOnClicked(); PlaySelectSound(); } } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { InputManager.UpdateCurrentStates(); #region UpdateLogic // Fps fps = (int)(1 / (float)gameTime.ElapsedGameTime.TotalSeconds); fpsText.SetText("Fps: " + fps); fpsText.Update(gameTime); // Time timeText.SetText(time.ToString()); time.Update(gameTime); // Console if (InputManager.OnKeyDown(Keys.Tab)) { gameConsole.Open(Keys.Tab); } // (Content of this region is only meant for debugging purposes.) #region Test // Exit Game (Debugging) if (InputManager.IsKeyDown(Keys.Escape) || InputManager.IsButtonDown(Buttons.Back)) { Exit(); } finiteStateMachine.Update(gameTime); #endregion #endregion InputManager.UpdatePreviousStates(); base.Update(gameTime); }
protected override void OnUpdate(float dt) { // Update self if (m_size < m_targetSize) { m_size = Math.Min(m_size + (dt / GROW_TIME), m_targetSize); UpdateTitleSize(); } else if (m_size > m_targetSize) { m_size = Math.Max(m_size - (dt / GROW_TIME), m_targetSize); UpdateTitleSize(); } // Update children m_mainLine.Update(dt); for (int i = 0; i < m_infoLines.Count; ++i) { var line = m_infoLines[i]; line.Update(dt); } m_continuePrompt.Update(dt); // Check close if (m_targetSize >= 1.0f && m_size >= 1.0f && Screen.ModalDialog == null) { if (Screen.CheckSelect()) { Close(); } else if (Screen.Mouse.Buttons[MouseButton.Left].Pressed) { Close(); } } }
public void Update(GameTime gameTime) { resumeText.Update(gameTime); mainMenuText.Update(gameTime); }
public void Update(GameTime gameTime) { scoreText.Update(gameTime); mainMenuText.Update(gameTime); diedText.Update(gameTime); }
private void refresh() { //todo show some animation during this transitioning = true; songNameList.Clear(); SongLibrary.cacheSongInfo(); //prob should make separate method since searching forces cache refresh lol. we are good coders dont worry foreach (var pair in SongLibrary.songInfos) { Text temp = new Text(Config.ClientSize, new Size(550, 35), new Point(0, 0)); /*SizeF temp1 = temp.getStringSize(pair.Value.Artist + " - " + pair.Value.SongName); temp.TextureSize = new Size((int)temp1.Width, (int)temp1.Height);*/ temp.Update(pair.Value.Artist + " - " + pair.Value.SongName); temp.Shadow = true; SelectComponent sc = new SelectComponent(game, new Rectangle(-50, 0, 550, 90), pair.Value.Artist, pair.Value.SongName); sc.clickEvent += new Action<int, SelectComponent>(sc_clickEvent); SongPair sp = new SongPair(sc, pair.Value); songNameList.Add(sp); sc.index = songNameList.IndexOf(sp); } songNameList.Sort(new Comparison<SongPair>(delegate(SongPair f, SongPair j) { return -f.Info.SongName.CompareTo(j.Info.SongName); })); foreach (SongPair sp in songNameList) { sp.select.index = songNameList.IndexOf(sp); } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { Time = gameTime.TotalGameTime.TotalMilliseconds; if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } if (State == GameState.Intro) { _introBalloon.Update(gameTime); if (GamePad.GetState(PlayerIndex.One).Buttons.Start == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Space)) { State = GameState.Level0A; Restart(); _justpressed = false; } } //If the player pressed space and it is not the intro screen... if (State != GameState.Intro && _justpressed && (GamePad.GetState(PlayerIndex.One).Buttons.Start == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Space))) { // ... if we are not already paused, then pause if (State != GameState.Pause) { Text = new Text("Paused", 1000 + Time); _currentLevel = State; State = GameState.Pause; } //... else resume the game. else { State = _currentLevel; } _justpressed = false; } // A method to skip levels for testing purposes. if (Keyboard.GetState().IsKeyDown(Keys.End) && _justpressed) { switch (State) { case GameState.Level0A: State = GameState.Level1; break; case GameState.Level0B: State = GameState.Level1; break; case GameState.Level1: State = GameState.Level2; break; case GameState.Level2: State = GameState.Level3; break; } Restart(); _justpressed = false; } if (Keyboard.GetState().IsKeyUp(Keys.End) && Keyboard.GetState().IsKeyUp(Keys.Space) && GamePad.GetState(PlayerIndex.One).IsButtonUp(Buttons.Start)) { _justpressed = true; } // TODO: Add your update logic here if (State != GameState.Pause) { // HERE WE UPDATE ALL SPRITES IN THE CURRENT LEVEL Level.Update(gameTime); // Check to see if ANYTHING collided CollisionHandler.Update(gameTime); //Check if we completed the level or failed it. CheckLevelDone(gameTime); } Text.Update(gameTime); if (ScreenShake != null) { ScreenShake.Update(); } base.Update(gameTime); }
protected override void StartMove(Selection sel) { Drawable drawable = null; SelectionPosition pos = SelectionPosition.BottomRight; bool resize = true, copycolor = true, sele = true; if (Tool == DrawTool.Selection) { if (Selections.Count == 0 && currentZoom != 1) { widget.SetCursorForTool(DrawTool.Move); inZooming = true; } return; } if (sel != null) { ClearSelection(); } switch (Tool) { case DrawTool.Line: drawable = new Line(MoveStart, new Point(MoveStart.X + 1, MoveStart.Y + 1), LineType, LineStyle); drawable.FillColor = Color; pos = SelectionPosition.LineStop; break; case DrawTool.Cross: drawable = new Cross(MoveStart, new Point(MoveStart.X + 1, MoveStart.Y + 1), LineStyle); break; case DrawTool.Ellipse: drawable = new Ellipse(MoveStart, 2, 2); break; case DrawTool.Rectangle: drawable = new Rectangle(MoveStart, 2, 2); break; case DrawTool.CircleArea: drawable = new Ellipse(MoveStart, 2, 2); drawable.FillColor = Color.Copy(); drawable.FillColor.A = byte.MaxValue / 2; break; case DrawTool.RectangleArea: drawable = new Rectangle(MoveStart, 2, 2); drawable.FillColor = Color.Copy(); drawable.FillColor.A = byte.MaxValue / 2; break; case DrawTool.Counter: drawable = new Counter(MoveStart, 3 * LineWidth, 0); drawable.FillColor = Color.Copy(); (drawable as Counter).TextColor = Color.Grey2; resize = false; break; case DrawTool.Text: case DrawTool.Player: { int width, heigth; Text text = new Text(MoveStart, 1, 1, ""); if (ConfigureObjectEvent != null) { ConfigureObjectEvent(text, Tool); } if (text.Value == null) { return; } Config.DrawingToolkit.MeasureText(text.Value, out width, out heigth, Config.Style.Font, FontSize, FontWeight.Normal); text.Update(new Point(MoveStart.X - width / 2, MoveStart.Y - heigth / 2), width, heigth); text.TextColor = TextColor.Copy(); text.FillColor = text.StrokeColor = TextBackgroundColor.Copy(); text.TextSize = FontSize; resize = copycolor = sele = false; drawable = text; break; } case DrawTool.Pen: case DrawTool.Eraser: handdrawing = true; break; case DrawTool.Zoom: { double newZoom = currentZoom; if (modifier == ButtonModifier.Shift) { newZoom -= 0.1; } else { newZoom += 0.1; } newZoom = Math.Max(newZoom, MinZoom); newZoom = Math.Min(newZoom, MaxZoom); Zoom(newZoom, MoveStart); break; } } if (drawable != null) { if (copycolor) { drawable.StrokeColor = Color.Copy(); } drawable.LineWidth = LineWidth; drawable.Style = LineStyle; var selo = Add(drawable); drawing.Drawables.Add(drawable); if (Tool == DrawTool.Counter) { UpdateCounters(); } if (sele) { if (resize) { UpdateSelection(new Selection(selo, pos, 5)); } else { UpdateSelection(new Selection(selo, SelectionPosition.All, 5)); } inObjectCreation = true; } widget.ReDraw(); } }
public void Update(GameTime gameTime) { scoreText.Update(gameTime); mainMenuText.Update(gameTime); congratulationText.Update(gameTime); }
public void CreateOrUpdate(Text txt) { if (txt.IsCreated) txt.Update(); else txt.Create(); }