public override void Draw(GameTime gameTime) { ExTexture2D exTexture = ScreenManager.GetTexture2D(General.Textures.GameOverBackground); SprintBatch.Begin(); SprintBatch.Draw(ScreenManager.GetTexture2D(General.Textures.OpacityBackground).Texture, Vector2.Zero, Color.White); SprintBatch.Draw(exTexture.Texture, exTexture.Position, Color.White); SpriteFont segoePrint48 = ScreenManager.GetSpriteFont(General.Fonts.SegoePrint48); SpriteFont segoePrint64 = ScreenManager.GetSpriteFont(General.Fonts.SegoePrint64); SprintBatch.DrawString( segoePrint48, _textEfficiency, Position.GetTextPosition(exTexture.Destination, segoePrint48, _textEfficiency, 220), General.Colors.SCORE_FONT, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); SprintBatch.DrawString( segoePrint64, _textPercent, Position.GetTextPosition(exTexture.Destination, segoePrint64, _textPercent, 300), General.Colors.SCORE_FONT, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); SprintBatch.End(); foreach (var menuEntry in MenuEntries) { menuEntry.Draw(gameTime, this); } }
private void AddTexture2D(string key, ExTexture2D texture) { if (!_textureDict.ContainsKey(key)) { _textureDict[key] = texture; } }
private void AddTexture2D(string key, Texture2D texture) { if (!_textureDict.ContainsKey(key)) { _textureDict[key] = new ExTexture2D(texture, new Rectangle(0, 0, texture.Width, texture.Height)); } }
protected override void LoadContent() { base.LoadContent(); Rectangle pauseButton = new Rectangle(GraphicsDevice.Viewport.Bounds.Width - (BUTTON_PAUSE + 20), 20, BUTTON_PAUSE, BUTTON_PAUSE); var pauseTexture = new ExTexture2D(Game.Content.Load <Texture2D>(General.Textures.Pause), pauseButton); var pauseTextureButton = new ExTexture2D(Game.Content.Load <Texture2D>(General.Textures.PauseButton), pauseButton); }
public ExTexture2D GetTexture2D(string key) { ExTexture2D texture = null; if (!_textureDict.TryGetValue(key, out texture)) { return(null); } return(texture); }
public override void LoadContent() { base.LoadContent(); int height = (int)(ScreenManager.Game.GraphicsDevice.Viewport.Bounds.Height * 0.2); int x = ScreenManager.Game.GraphicsDevice.Viewport.Bounds.Width / 2; int y = (ScreenManager.Game.GraphicsDevice.Viewport.Bounds.Height - height) / 2; _finishTextDest = new Rectangle(x, y, 0, height); _exTexture = ScreenManager.GetTexture2D(General.Textures.Finish); }
private void AddTexture2D(string key, Rectangle destination, Color color, int borderThickness, int borderRadius, int borderShadow) { if (!_textureDict.ContainsKey(key)) { int width = destination.Width; int height = destination.Height; Texture2D texture = new Texture2D(GraphicsDevice, width, height); StaticTexture2D.FillTexture2DWithRoundCorners(ref texture, width, height, color, borderThickness, borderRadius, borderShadow); _textureDict[key] = new ExTexture2D(texture, destination); } }
private void AddTexture2D(string key, Rectangle destination, Color color) { if (!_textureDict.ContainsKey(key)) { int width = destination.Width; int height = destination.Height; Texture2D texture = new Texture2D(GraphicsDevice, width, height); StaticTexture2D.FillTexture2D(ref texture, width, height, color); _textureDict[key] = new ExTexture2D(texture, destination); } }
private void AddTexture2D(string key, Color color) { if (!_textureDict.ContainsKey(key)) { int width = GraphicsDevice.Viewport.Width; int height = GraphicsDevice.Viewport.Height; Texture2D texture = new Texture2D(GraphicsDevice, width, height); StaticTexture2D.FillTexture2D(ref texture, width, height, color); _textureDict[key] = new ExTexture2D(texture, new Rectangle(0, 0, width, height)); } }
public override void Draw(GameTime gameTime) { ExTexture2D exTexture = ScreenManager.GetTexture2D(General.Textures.PauseBackground); SprintBatch.Begin(); SprintBatch.Draw(ScreenManager.GetTexture2D(General.Textures.OpacityBackground).Texture, Vector2.Zero, Color.White); SprintBatch.Draw(exTexture.Texture, exTexture.Position, Color.White); SprintBatch.End(); foreach (var menuEntry in MenuEntries) { menuEntry.Draw(gameTime, this); } }
public void Draw(GameTime gameTime, MenuScreen screen) { ScreenManager screenManager = screen.ScreenManager; SpriteBatch spriteBatch = screenManager.SpriteBatch; ExTexture2D exTexture = screenManager.GetTexture2D(Texture); SpriteFont spriteFont = screenManager.GetSpriteFont(SpriteFont); spriteBatch.Begin(); if (_scaleCount == 0) { spriteBatch.Draw( exTexture.Texture, exTexture.Destination, Color.White ); } else if (_scaleCount > 0) { float addX = (exTexture.Destination.Width * .1f) / 2; float addY = (exTexture.Destination.Height * .1f) / 2; spriteBatch.Draw(exTexture.Texture, new Vector2(exTexture.Destination.X + addX, exTexture.Destination.Y + addY), null, Color.White, 0f, Vector2.Zero, new Vector2(.9f, .9f), SpriteEffects.None, 0f); if (_scaleCount == 1) { _isEnd = true; } _scaleCount--; } if (!string.IsNullOrWhiteSpace(Text)) { spriteBatch.DrawString( spriteFont, Text, Position.GetTextPosition(exTexture.Destination, spriteFont, Text), TextColor, Rotation, Vector2.Zero, Scale, SpriteEffects.None, 0f); } spriteBatch.End(); }
public override void HandleInput(InputState input) { foreach (GestureSample gesture in input.Gestures) { if (gesture.GestureType == GestureType.Tap) { Point tapLocation = new Point((int)gesture.Position.X, (int)gesture.Position.Y); for (int i = 0; i < _menuEntries.Count; i++) { MenuEntry menuEntry = _menuEntries[i]; ExTexture2D exTexture = ScreenManager.GetTexture2D(menuEntry.Texture); if (exTexture.Destination.Contains(tapLocation)) { OnSelectEntry(i); } } } } }