public override void Draw(GameTime gameTime) { GameRef.SpriteBatch.Begin(); GameRef.SpriteBatch.Draw(_background, new Rectangle(0, 0, Config.Resolution.X, Config.Resolution.Y), Color.DeepSkyBlue); GameRef.SpriteBatch.DrawString(_titleFont, _title, new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - _titleFont.MeasureString(_title).X / 2 + 5, Game.GraphicsDevice.Viewport.Height / 2f - (_titleFont.MeasureString(_title).Y * 2) + 5), Color.Black); GameRef.SpriteBatch.DrawString(_titleFont, _title, new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - _titleFont.MeasureString(_title).X / 2, Game.GraphicsDevice.Viewport.Height / 2f - (_titleFont.MeasureString(_title).Y * 2)), Color.White); for (int i = 0; i < _messages.Length; i++) { GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, _messages[i], new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - ControlManager.SpriteFont.MeasureString(_messages[i]).X / 2, Game.GraphicsDevice.Viewport.Height / 2f - ControlManager.SpriteFont.MeasureString(_messages[i]).Y / 2 + 20 * i), Color.White); } GameRef.SpriteBatch.End(); ControlManager.Draw(GameRef.SpriteBatch); base.Draw(gameTime); }
public override void Draw(GameTime gameTime) { Rectangle r = new Rectangle(50, 400, 64, 64); int _width = 50; GameRef.SpriteBatch.Begin(); base.Draw(gameTime); ControlManager.Draw(GameRef.SpriteBatch); foreach (var i in _reward.Items) { GameItem item = GameItemManager.GetItem(i); item.Draw(GameRef.SpriteBatch, r); _width += 72; r.X += 72; if (_width >= GameRef.ScreenRectangle.Width - 50) { _width = 72; r.Y += 72; } } GameRef.SpriteBatch.End(); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); _str.Text = $"{GamePlayScreen.Player.Character.Entity.Strength}"; _dex.Text = $"{GamePlayScreen.Player.Character.Entity.Dexterity}"; _cun.Text = $"{GamePlayScreen.Player.Character.Entity.Cunning}"; _mag.Text = $"{GamePlayScreen.Player.Character.Entity.Magic}"; _wil.Text = $"{GamePlayScreen.Player.Character.Entity.Willpower}"; _con.Text = $"{GamePlayScreen.Player.Character.Entity.Constitution}"; _lvl.Text = $"{GamePlayScreen.Player.Character.Entity.Level}"; _xp.Text = $"{GamePlayScreen.Player.Character.Entity.Experience}"; _hp.Text = $"{GamePlayScreen.Player.Character.Entity.Health.CurrentValue} / {GamePlayScreen.Player.Character.Entity.Health.MaximumValue}"; _resName.Text = GamePlayScreen.Player.Character.Entity.Mana.MaximumValue > 0 ? "MP:" : "SP:"; _res.Color = GamePlayScreen.Player.Character.Entity.Mana.MaximumValue > 0 ? Color.Yellow : Color.Blue; _res.Text = GamePlayScreen.Player.Character.Entity.Mana.MaximumValue > 0 ? $"{GamePlayScreen.Player.Character.Entity.Mana.CurrentValue} / " + $"{GamePlayScreen.Player.Character.Entity.Mana.MaximumValue}" : $"{GamePlayScreen.Player.Character.Entity.Stamina.CurrentValue} / " + $"{GamePlayScreen.Player.Character.Entity.Stamina.MaximumValue}"; GameRef.SpriteBatch.Begin(); GameRef.SpriteBatch.Draw(_background, new Rectangle((1280 - 500) / 2, (720 - 500) / 2, 500, 500), Color.White); ControlManager.Draw(GameRef.SpriteBatch); GameRef.SpriteBatch.End(); }
public override void Draw(GameTime gameTime) { FinalBomber.Instance.SpriteBatch.Begin(); base.Draw(gameTime); ControlManager.Draw(FinalBomber.Instance.SpriteBatch); if (hasConnected) { FinalBomber.Instance.SpriteBatch.DrawString(this.BigFont, "Connecté au serveur !", Vector2.Zero, Color.Red); } for (int i = 0; i < MenuString.Length; i++) { Color textColor = Color.Black; if (i == IndexMenu) { textColor = Color.Green; } FinalBomber.Instance.SpriteBatch.DrawString(this.BigFont, MenuString[i], new Vector2(MenuPosition.X - this.BigFont.MeasureString(MenuString[i]).X / 2, MenuPosition.Y + this.BigFont.MeasureString(MenuString[i]).Y *i - this.BigFont.MeasureString(MenuString[i]).Y / 2), textColor); } FinalBomber.Instance.SpriteBatch.End(); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); _str.Text = $"{GamePlayScreen.Player.Character.Entity.Strength}"; _dex.Text = $"{GamePlayScreen.Player.Character.Entity.Dexterity}"; _cun.Text = $"{GamePlayScreen.Player.Character.Entity.Cunning}"; _mag.Text = $"{GamePlayScreen.Player.Character.Entity.Magic}"; _wil.Text = $"{GamePlayScreen.Player.Character.Entity.Willpower}"; _con.Text = $"{GamePlayScreen.Player.Character.Entity.Constitution}"; _lvl.Text = $"{GamePlayScreen.Player.Character.Entity.Level}"; _xp.Text = $"{GamePlayScreen.Player.Character.Entity.Experience}"; _hp.Text = $"{GamePlayScreen.Player.Character.Entity.Health.CurrentValue} / {GamePlayScreen.Player.Character.Entity.Health.MaximumValue}"; _resName.Text = GamePlayScreen.Player.Character.Entity.Mana.MaximumValue > 0 ? "MP:" : "SP:"; _res.Color = GamePlayScreen.Player.Character.Entity.Mana.MaximumValue > 0 ? Color.Yellow : Color.Blue; _res.Text = GamePlayScreen.Player.Character.Entity.Mana.MaximumValue > 0 ? $"{GamePlayScreen.Player.Character.Entity.Mana.CurrentValue} / " + $"{GamePlayScreen.Player.Character.Entity.Mana.MaximumValue}" : $"{GamePlayScreen.Player.Character.Entity.Stamina.CurrentValue} / " + $"{GamePlayScreen.Player.Character.Entity.Stamina.MaximumValue}"; GameRef.SpriteBatch.Begin(); GameRef.SpriteBatch.Draw(_background, new Rectangle(0, 0, 1280, 720), Color.White); Entity e = GamePlayScreen.Player.Character.Entity; if (e.MainHand != null) { e.MainHand.Draw(GameRef.SpriteBatch, _mainGear); } if (e.OffHand != null) { e.OffHand.Draw(GameRef.SpriteBatch, _offGear); } if (e.Head != null) { e.Head.Draw(GameRef.SpriteBatch, _headGear); } if (e.Body != null) { e.Body.Draw(GameRef.SpriteBatch, _bodyGear); } if (e.Hands != null) { e.Hands.Draw(GameRef.SpriteBatch, _handGear); } if (e.Feet != null) { e.Feet.Draw(GameRef.SpriteBatch, _footGear); } ControlManager.Draw(GameRef.SpriteBatch); GameRef.SpriteBatch.End(); }
public override void Draw(Microsoft.Xna.Framework.GameTime gameTime) { GameRef.spriteBatch.Begin(); base.Draw(gameTime); ControlManager.Draw(GameRef.spriteBatch); GameRef.spriteBatch.End(); }
public override void Draw(GameTime gameTime) { FinalBomber.Instance.SpriteBatch.Begin(); base.Draw(gameTime); FinalBomber.Instance.SpriteBatch.Draw(_backgroundImage, FinalBomber.Instance.ScreenRectangle, Color.White); ControlManager.Draw(FinalBomber.Instance.SpriteBatch); if (_enableMenu) { for (int i = 0; i < MenuString.Length; i++) { Color textColor = Color.Black; if (i == IndexMenu) { textColor = Color.Green; } FinalBomber.Instance.SpriteBatch.DrawString(BigFont, MenuString[i], new Vector2(MenuPosition.X - BigFont.MeasureString(MenuString[i]).X / 2, MenuPosition.Y + BigFont.MeasureString(MenuString[i]).Y *i - BigFont.MeasureString(MenuString[i]).Y / 2), textColor); } } FinalBomber.Instance.SpriteBatch.End(); }
public override void Draw(GameTime gameTime) { GameRef.spriteBatch.Begin(); base.Draw(gameTime); ControlManager.Draw(GameRef.spriteBatch); GameRef.spriteBatch.End(); }
public override void Draw(GameTime gameTime) { FinalBomber.Instance.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, Matrix.Identity); base.Draw(gameTime); ControlManager.Draw(FinalBomber.Instance.SpriteBatch); Color textColor = Color.Black; if (_indexPlayer >= 0) { string text = "Changement des touches\nde " + Config.PlayersName[_indexPlayer]; FinalBomber.Instance.SpriteBatch.DrawString(BigFont, text, new Vector2(MenuPosition.X / 1.5f, (BigFont.MeasureString(text).Y) / 2), textColor); FinalBomber.Instance.SpriteBatch.DrawString(BigFont, _instructions[0], new Vector2(MenuPosition.X / 1.5f, 2 * (BigFont.MeasureString(_instructions[0]).Y)), Color.Black); FinalBomber.Instance.SpriteBatch.DrawString(BigFont, _instructions[1], new Vector2(MenuPosition.X / 1.5f + 250 - BigFont.MeasureString(_instructions[1]).X / 2, 6 * (BigFont.MeasureString(_instructions[1]).Y)), Color.Black); } else { for (int i = 0; i < MenuString.Length; i++) { textColor = i == IndexMenu ? Color.Green : Color.Black; FinalBomber.Instance.SpriteBatch.DrawString(BigFont, MenuString[i], new Vector2(MenuPosition.X, MenuPosition.Y + (BigFont.MeasureString(MenuString[i]).Y) * i), textColor); } } FinalBomber.Instance.SpriteBatch.End(); }
/* The Draw() function is far simpler than the Update() function. * The SpriteBatch is called to start using settings that display the sprites without antialiasing. * After that, the parent Draw() function is called, and the ControlManager is drawn. * Finally, the SpriteBatch ends, which flushes the drawn sprites out of the SpriteBatch's internal buffer to the screen. */ public override void Draw(GameTime gameTime) { GameRef.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); base.Draw(gameTime); ControlManager.Draw(GameRef.SpriteBatch); GameRef.SpriteBatch.End(); }
public override void Draw(GameTime gameTime) { ControlManager.Draw(GameRef.SpriteBatch); GameRef.SpriteBatch.Begin(); GameRef.SpriteBatch.Draw(_background, new Rectangle(0, 0, Config.Resolution.X, Config.Resolution.Y), Color.Red); GameRef.SpriteBatch.DrawString(_titleFont, _title, new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - _titleFont.MeasureString(_title).X / 2 + 5, Game.GraphicsDevice.Viewport.Height / 2f - (_titleFont.MeasureString(_title).Y * 2) + 5), Color.Black); GameRef.SpriteBatch.DrawString(_titleFont, _title, new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - _titleFont.MeasureString(_title).X / 2, Game.GraphicsDevice.Viewport.Height / 2f - (_titleFont.MeasureString(_title).Y * 2)), Color.White); for (int i = 0; i < _content.Count; i++) { GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, _content[i], new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - ControlManager.SpriteFont.MeasureString(_content[i]).X / 2 + 1, Game.GraphicsDevice.Viewport.Height / 2f - ControlManager.SpriteFont.MeasureString(_content[i]).Y / 2 + 20 * i - ((20 * _content.Count) / 2f) + 1), Color.Black); GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, _content[i], new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - ControlManager.SpriteFont.MeasureString(_content[i]).X / 2, Game.GraphicsDevice.Viewport.Height / 2f - ControlManager.SpriteFont.MeasureString(_content[i]).Y / 2 + 20 * i - ((20 * _content.Count) / 2f)), Color.White); } for (int i = 0; i < _actions.Length; i++) { Color color = Color.White; if (i == _menuIndex) { color = Color.Red; } GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, _actions[i], new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - ControlManager.SpriteFont.MeasureString(_actions[i]).X / 2 + 1, Game.GraphicsDevice.Viewport.Height / 2f - ControlManager.SpriteFont.MeasureString(_actions[i]).Y / 2 + 20 * _content.Count + 20 * i + 1), Color.Black); GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, _actions[i], new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - ControlManager.SpriteFont.MeasureString(_actions[i]).X / 2, Game.GraphicsDevice.Viewport.Height / 2f - ControlManager.SpriteFont.MeasureString(_actions[i]).Y / 2 + 20 * _content.Count + 20 * i), color); } GameRef.SpriteBatch.End(); base.Draw(gameTime); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); if (currentState == State.Playing || currentState == State.Frozen) { gameRef.GraphicsDevice.SetRenderTarget(mainTarget); gameRef.GraphicsDevice.Clear(Color.Transparent); var spriteBatch = gameRef.spriteBatch; spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Camera.GetTransform()); LevelManager.Draw(spriteBatch, gameTime); EntityManager.Draw(spriteBatch, gameTime); spriteBatch.End(); gameRef.GraphicsDevice.SetRenderTarget(null); spriteBatch.Begin(); spriteBatch.Draw(mainTarget, Vector2.Zero, Color.White); hud.Draw(gameTime, spriteBatch); spriteBatch.End(); } else { var spriteBatch = gameRef.spriteBatch; Texture2D result = blurOverlay.PerformGaussianBlur((Texture2D)mainTarget, target1, target2, spriteBatch); spriteBatch.Begin(); spriteBatch.Draw(result, Vector2.Zero, Color.White); spriteBatch.Draw(background, new Rectangle(0, 0, MainGame.GAME_WIDTH, MainGame.GAME_HEIGHT), Color.Black * .6f); switch (pauseState) { case State_Paused.Normal: pauseControls_Normal.Draw(spriteBatch, gameTime); break; case State_Paused.Save: pauseControls_Save.Draw(spriteBatch, gameTime); break; case State_Paused.Quit: pauseControls_Quit.Draw(spriteBatch, gameTime); break; default: break; } spriteBatch.End(); } gameRef.spriteBatch.Begin(); FadeOutRect.Draw(gameRef.spriteBatch, Vector2.Zero, FadeOutColor); gameRef.spriteBatch.End(); }
/* Draw() initializes a SpriteBatch object with a draw buffer and calls the parent function. * It then draws the splashImage to the window rectangle with no tint colour. * The goLabel is drawn by calling ControlManager.Draw(), and then End() sends the contents of the draw buffer to the screen. */ public override void Draw(GameTime gameTime) { GameRef.SpriteBatch.Begin(); base.Draw(gameTime); GameRef.SpriteBatch.Draw(splashImage, GameRef.ScreenRectangle, Color.White); ControlManager.Draw(GameRef.SpriteBatch); GameRef.SpriteBatch.End(); }
public override void Draw(GameTime gameTime) { GameRef.SpriteBatch.Begin(); base.Draw(gameTime); GameRef.SpriteBatch.Draw(_backgroundImage, GameRef.ScreenBounds, Color.White); ControlManager.Draw(GameRef.SpriteBatch); GameRef.SpriteBatch.End(); }
public override void Draw(GameTime gameTime) { FinalBomber.Instance.SpriteBatch.Begin(); base.Draw(gameTime); ControlManager.Draw(FinalBomber.Instance.SpriteBatch); if (statusMsg != "") { FinalBomber.Instance.SpriteBatch.DrawString(this.BigFont, statusMsg, Vector2.Zero, Color.Red); } for (int i = 0; i < menuString.Length; i++) { Color textColor = Color.Black; if (i == indexMenu) { textColor = Color.Green; } FinalBomber.Instance.SpriteBatch.DrawString(this.BigFont, menuString[i], new Vector2(menuPosition.X - this.BigFont.MeasureString(menuString[i]).X / 2, menuPosition.Y + 2 * (this.BigFont.MeasureString(menuString[i]).Y *i) - this.BigFont.MeasureString(menuString[i]).Y / 2), textColor); if (i == 0 || i == 1) { FinalBomber.Instance.SpriteBatch.DrawString(this.BigFont, ": ", new Vector2(menuPosition.X + this.BigFont.MeasureString(menuString[i]).X / 2, menuPosition.Y + 2 * (this.BigFont.MeasureString(menuString[i]).Y *i) - this.BigFont.MeasureString(menuString[i]).Y / 2), Color.White); } } if ((indexMenu == 0 || indexMenu == 1) && textCursorBlinkFrequency > Config.TextCursorBlinkFrequency / 2f) { FinalBomber.Instance.SpriteBatch.DrawString(this.BigFont, "|", new Vector2(menuPosition.X + this.BigFont.MeasureString(login[indexMenu]).X / 2, menuPosition.Y + 2 * (this.BigFont.MeasureString(menuString[indexMenu]).Y *indexMenu) - this.BigFont.MeasureString(menuString[indexMenu]).Y / 2 + this.BigFont.MeasureString(menuString[indexMenu]).Y), Color.White); } FinalBomber.Instance.SpriteBatch.DrawString(this.BigFont, login[0], new Vector2(menuPosition.X - this.BigFont.MeasureString(login[0]).X / 2, menuPosition.Y - this.BigFont.MeasureString(menuString[0]).Y / 2 + this.BigFont.MeasureString(menuString[0]).Y), Color.White); FinalBomber.Instance.SpriteBatch.DrawString(this.BigFont, Functions.HidePassword(login[1]), new Vector2(menuPosition.X - this.BigFont.MeasureString(Functions.HidePassword(login[1])).X / 2, menuPosition.Y - this.BigFont.MeasureString(menuString[1]).Y / 2 + 3 * this.BigFont.MeasureString(menuString[1]).Y), Color.White); FinalBomber.Instance.SpriteBatch.End(); }
public override void Draw(GameTime gameTime) { var batch = gameRef.spriteBatch; batch.Begin(); controls.Draw(gameRef.spriteBatch, gameTime); batch.End(); base.Draw(gameTime); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); GameRef.SpriteBatch.Draw( backgroundImage, GameRef.ScreenRectangle, Color.White); ControlManager.Draw(GameRef.SpriteBatch); }
public override void Draw(GameTime gameTime) { GameRef.SpriteBatch.Begin(); base.Draw(gameTime); ControlManager.Draw(GameRef.SpriteBatch); BubbleManager.Draw(GameRef.SpriteBatch); GameRef.SpriteBatch.DrawString(smallFont, "Fish eaten: " + player.fishEaten.ToString(), new Vector2(30, 30), Color.White); GameRef.SpriteBatch.End(); player.Draw(GameRef.SpriteBatch); EnemyManager.Draw(GameRef.SpriteBatch); }
/* Drawing the StartScreen involves drawing all the controls on the screen. */ public override void Draw(GameTime gameTime) { /* The SpriteBatch.Begin() function is called to create the memory buffer that will be drawn to. */ GameRef.SpriteBatch.Begin(); base.Draw(gameTime); /* ControlManager.Draw() draws every control to the memory buffer. * SpriteBatch.End() then sends the contents of the buffer to the actual screen. */ ControlManager.Draw(GameRef.SpriteBatch); GameRef.SpriteBatch.End(); }
public override void Draw(GameTime gameTime) { FinalBomber.Instance.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, Matrix.Identity); base.Draw(gameTime); ControlManager.Draw(FinalBomber.Instance.SpriteBatch); for (int i = 0; i < MenuString.Length; i++) { Color textColor = Color.Black; if (i == IndexMenu) { textColor = Color.Green; } FinalBomber.Instance.SpriteBatch.DrawString(this.BigFont, MenuString[i], new Vector2(MenuPosition.X, MenuPosition.Y + (this.BigFont.MeasureString(MenuString[i]).Y) * i), textColor); if (i != 4) { FinalBomber.Instance.SpriteBatch.DrawString(this.BigFont, ": ", new Vector2(MenuPosition.X + this.BigFont.MeasureString(MenuString[i]).X, MenuPosition.Y + this.BigFont.MeasureString(MenuString[i]).Y *i), Color.Black); if (i == 0) { FinalBomber.Instance.SpriteBatch.DrawString(this.BigFont, GameConfiguration.ActiveSuddenDeath.ToString(), new Vector2(MenuPosition.X + this.BigFont.MeasureString(MenuString[i] + ": ").X, MenuPosition.Y + this.BigFont.MeasureString(MenuString[i]).Y *i), Color.Black); } else if (i == 1) { FinalBomber.Instance.SpriteBatch.DrawString(this.BigFont, GameConfiguration.SuddenDeathTimer.ToString(), new Vector2(MenuPosition.X + this.BigFont.MeasureString(MenuString[i] + ": ").X, MenuPosition.Y + this.BigFont.MeasureString(MenuString[i]).Y *i), Color.Black); } else if (i == 2) { FinalBomber.Instance.SpriteBatch.DrawString(this.BigFont, (100 - (GameConfiguration.SuddenDeathWallSpeed - 0.1f) * 100).ToString() + "%", new Vector2(MenuPosition.X + this.BigFont.MeasureString(MenuString[i] + ": ").X, MenuPosition.Y + this.BigFont.MeasureString(MenuString[i]).Y *i), Color.Black); } else if (i == 3) { FinalBomber.Instance.SpriteBatch.DrawString(this.BigFont, Config.SuddenDeathTypeText[GameConfiguration.SuddenDeathType], new Vector2(MenuPosition.X + this.BigFont.MeasureString(MenuString[i] + ": ").X, MenuPosition.Y + this.BigFont.MeasureString(MenuString[i]).Y *i), Color.Black); } } } FinalBomber.Instance.SpriteBatch.End(); }
public override void Draw(GameTime gameTime) { GameRef.SpriteBatch.Begin(); base.Draw(gameTime); //GameRef.SpriteBatch.Draw(sprite, positionSprite, Color.White); ControlManager.Draw(GameRef.SpriteBatch); GameRef.SpriteBatch.End(); }
public void Draw(SpriteBatch batch, GameTime gameTime) { batch.Begin(); batch.Draw(background, bounds, Color.White); batch.Draw(gameRef.level.GetTileSet(selectedTileSetIndex).Image, new Rectangle((int)startPos.X, (int)startPos.Y, Engine.TileWidth, Engine.TileHeight), gameRef.level.GetTileSet(selectedTileSetIndex).SourceRectangles[selectedTileIndex], Color.White); controls.Draw(batch, gameTime); //selector.Draw(batch, gameTime); batch.End(); }
/* Draw() follows a similar pattern to Draw() functions in other screens. */ public override void Draw(GameTime gameTime) { /* The Begin() method is called with a set of arguments that display small sprites clearly when scaled up. * This ensures that the sprites are not blurred by anti-aliasing. */ GameRef.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); base.Draw(gameTime); /* All the controls are drawn to a buffer using the SpriteBatch. */ ControlManager.Draw(GameRef.SpriteBatch); /* Finally, the contents of the buffer are sent to the screen. */ GameRef.SpriteBatch.End(); }
public override void Draw(GameTime gameTime) { var batch = gameRef.spriteBatch; batch.Begin(); anim.Draw(batch, gameTime, new Rectangle(0, 0, MainGame.GAME_WIDTH, MainGame.GAME_HEIGHT)); #if DEBUG batch.DrawString(debugFont, "DEBUGGING -- " + MainGame.VERSION, new Vector2(MainGame.GAME_WIDTH - debugFont.MeasureString( "DEBUGGING -- " + MainGame.VERSION).X - 5, MainGame.GAME_HEIGHT - debugFont.LineSpacing - 2), Color.White); #else batch.DrawString(debugFont, MainGame.VERSION, new Vector2(MainGame.GAME_WIDTH - debugFont.MeasureString( MainGame.VERSION).X - 2, MainGame.GAME_HEIGHT - debugFont.LineSpacing - 2), Color.White); #endif batch.End(); base.Draw(gameTime); batch.Begin(); { menuControls.Draw(batch, gameTime); batch.Draw(titleImage, new Vector2(MainGame.GAME_WIDTH / 2 - title.Width - 280, 70), Color.White); if (currentState != State.Menu) { batch.Draw(blackOverlay, Vector2.Zero, Color.Black * 0.8f); } switch (currentState) { case State.NewGame: newGameControls.Draw(batch, gameTime); break; case State.LoadGame: loadGameControls.Draw(batch, gameTime); break; case State.Options: optionsControls.Draw(batch, gameTime); break; case State.Quit: quitControls.Draw(batch, gameTime); break; } FadeOutRect.Draw(batch, Vector2.Zero, FadeOutColor); } batch.End(); }
public override void Draw(GameTime gameTime) { ControlManager.Draw(GameRef.SpriteBatch); GameRef.SpriteBatch.Begin(); GameRef.SpriteBatch.Draw(_backgroundImage, _backgroundMainRectangle, Color.White); GameRef.SpriteBatch.Draw(_backgroundImage, _backgroundRightRectangle, Color.White); GameRef.SpriteBatch.Draw(_backgroundImage, _backgroundTopRectangle, Color.White); GameRef.SpriteBatch.Draw(_backgroundImage, _backgroundTopRightRectangle, Color.White); GameRef.SpriteBatch.Draw(_logo, new Vector2( (GameRef.Graphics.GraphicsDevice.Viewport.Width / 2) - (_logo.Width / 2), 100), Color.White); for (int i = 0; i < _menuText.Length; i++) { Color textColor = Color.White; if (i == _menuIndex) { textColor = Color.OrangeRed; } GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, _menuText[i], new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - (ControlManager.SpriteFont.MeasureString(_menuText[i]).X / 2f) + 1, Game.GraphicsDevice.Viewport.Height / 2f - 50 + (50 * i) + 1), Color.Black); GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, _menuText[i], new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - (ControlManager.SpriteFont.MeasureString(_menuText[i]).X / 2f), Game.GraphicsDevice.Viewport.Height / 2f - 50 + (50 * i)), textColor); } GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, "[" + _menuDescription[_menuIndex] + "]", new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - (ControlManager.SpriteFont.MeasureString(_menuDescription[_menuIndex]).X / 2f) - 4 + 1, Game.GraphicsDevice.Viewport.Height - 60 + 1), Color.Black); GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, "[" + _menuDescription[_menuIndex] + "]", new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - (ControlManager.SpriteFont.MeasureString(_menuDescription[_menuIndex]).X / 2f) - 4, Game.GraphicsDevice.Viewport.Height - 60), Color.White); string credits = "Credits: " + PlayerData.Credits.ToString(CultureInfo.InvariantCulture); GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, credits, new Vector2(1, Game.GraphicsDevice.Viewport.Height - ControlManager.SpriteFont.MeasureString(credits).Y + 1), Color.Black); GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, credits, new Vector2(0, Game.GraphicsDevice.Viewport.Height - ControlManager.SpriteFont.MeasureString(credits).Y), Color.White); GameRef.SpriteBatch.End(); base.Draw(gameTime); }
public override void Draw(Microsoft.Xna.Framework.GameTime gameTime) { GameRef.spriteBatch.Begin(); base.Draw(gameTime); ControlManager.Draw(GameRef.spriteBatch); if (textBox) { Vector2 FontOrigin = font.MeasureString(text) / 2; GameRef.spriteBatch.Draw(Game.Content.Load <Texture2D>(@"Images/textBox"), new Vector2(textPos.X - 375, textPos.Y - 75), new Rectangle(0, 400, 725, 200), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.5f); GameRef.spriteBatch.DrawString(font, text, textPos, Color.Black, 0, FontOrigin, 1.0f, SpriteEffects.None, 1f); } GameRef.spriteBatch.End(); }
public override void Draw(GameTime gameTime) { GameRef.SpriteBatch.Begin(); base.Draw(gameTime); GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, _message, new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - ControlManager.SpriteFont.MeasureString(_message).X / 2, Game.GraphicsDevice.Viewport.Height / 2f - ControlManager.SpriteFont.MeasureString(_message).Y / 2), Color.White); ControlManager.Draw(GameRef.SpriteBatch); GameRef.SpriteBatch.End(); }
public override void Draw(GameTime gameTime) { GameRef.SpriteBatch.Begin(); GameRef.SpriteBatch.Draw(_background, new Rectangle(0, 0, Config.Resolution.X, Config.Resolution.Y), Color.Yellow); GameRef.SpriteBatch.DrawString(_titleFont, _title, new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - _titleFont.MeasureString(_title).X / 2 + 5, Game.GraphicsDevice.Viewport.Height / 2f - (_titleFont.MeasureString(_title).Y * 2) + 5), Color.Black); GameRef.SpriteBatch.DrawString(_titleFont, _title, new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - _titleFont.MeasureString(_title).X / 2, Game.GraphicsDevice.Viewport.Height / 2f - (_titleFont.MeasureString(_title).Y * 2)), Color.White); int i = 0; foreach (KeyValuePair <string, Keys> pair in Config.PlayerKeyboardInputs) { Color textColor = Color.White; if (i == _menuIndex) { textColor = Color.OrangeRed; } string text = pair.Key + ": " + pair.Value; GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, text, new Vector2( Game.GraphicsDevice.Viewport.Width / 2f - ControlManager.SpriteFont.MeasureString(text).X / 2, Game.GraphicsDevice.Viewport.Height / 2f - ControlManager.SpriteFont.MeasureString(text).Y / 2 + 50 * i - 50), textColor); i++; } GameRef.SpriteBatch.End(); ControlManager.Draw(GameRef.SpriteBatch); base.Draw(gameTime); }
public override void Draw(GameTime gameTime) { GameRef.SpriteBatch.Begin( SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, Matrix.Identity); _map.Draw(GameRef.SpriteBatch, _player.Camera); _sprite.Draw(gameTime, GameRef.SpriteBatch, _player.Camera); _hud.Draw(_player, GameRef.SpriteBatch); base.Draw(gameTime); ControlManager.Draw(GameRef.SpriteBatch); GameRef.SpriteBatch.End(); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); GameRef.SpriteBatch.Begin(); ControlManager.Draw(GameRef.SpriteBatch); GameRef.SpriteBatch.DrawString(FontManager.GetFont("testfont"), $"Found {Gold} gold!", Vector2.One * 10, Color.Yellow); Rectangle destination = new Rectangle(50, 50, 32, 32); Point mouse = InputHandler.MouseAsPoint; int i = 0; _over = false; _index = -1; foreach (GameItem item in Items) { item.Draw(GameRef.SpriteBatch, destination); if (destination.Contains(mouse)) { _over = true; _index = i; } destination.X += 50; if (destination.X > GameRef.ScreenRectangle.Width - 50 - 32) { destination.X = 50; destination.Y += 50; } i++; } GameRef.SpriteBatch.End(); }
public void DrawControls(SpriteBatch spriteBatch, ControlManager controls) { if (controls != null) { controls.Draw(spriteBatch); } }