public void DrawMainMenu(SpriteBatch spriteBatch) { Vector2 position = getXYtoDrawMenu(); mainMenu.Draw(spriteBatch, position); switch (device) { #region DrawMainMenu Desktop case CurrentDevice.Desktop: btnPlay.setPosition(new Vector2(330 + (int)position.Y, 255 + (int)position.X)); btnPlay.Draw(spriteBatch); break; #endregion #region DrawMainMenu Phone case CurrentDevice.Phone: spriteBatch.DrawString(font, startGame, new Vector2(270 + (int)position.Y, 240 + (int)position.X), Color.Black * transparency); break; #endregion } }
public void DrawPause(SpriteBatch spriteBatch) { Vector2 position = getXYtoDrawMenu(); switch (device) { #region DrawPause Desktop case CurrentDevice.Desktop: backToGameButton.setPosition(new Vector2(330 + (int)position.Y, 300 + (int)position.X)); backToGameButton.Draw(spriteBatch); exitButton.setPosition(new Vector2(330 + (int)position.Y, 350 + (int)position.X)); exitButton.Draw(spriteBatch); break; #endregion #region DrawPause Phone case CurrentDevice.Phone: spriteBatch.DrawString(font, backToGame, new Vector2(300 + (int)position.Y, 240 + (int)position.X), Color.Black * transparency); spriteBatch.DrawString(font, quitGame, new Vector2(300 + (int)position.Y, 270 + (int)position.X), Color.Black * transparency); break; #endregion } }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); switch (CurrentGameState) { case GameState.MainMenu: btnPlay.Draw(spriteBatch); break; case GameState.Playing: break; } Marcel_Basis.Draw(spriteBatch, GlobalVars); Marco_Basis.Draw(spriteBatch, GlobalVars); Marc_Basis.Draw(spriteBatch, GlobalVars); Paul_Basis.Draw(spriteBatch, GlobalVars); Eljakim_Basis.Draw(spriteBatch, GlobalVars); spriteBatch.End(); /* TODO: Add your drawing code here * * * * */ base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); // starts drawing the game spriteBatch.Draw(background, backbounds, Color.White); // draws the background of the game spriteBatch.End(); // stops drawing spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, //blends sprites together SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, camera.Transform); // uses camera as the scrolling point switch (CurrentGameState) { case GameState.MainMenu: btnplay.Draw(spriteBatch); // draws the button var screenCenter = new Vector2(GraphicsDevice.Viewport.Bounds.Width / 2, GraphicsDevice.Viewport.Bounds.Height / 5); // sets the centre of screen var textureCenter = new Vector2(Title.Width / 2, Title.Height / 2); // sets the centre of screen height spriteBatch.Draw(Title, screenCenter, null, Color.White, 0f, textureCenter, 1f, SpriteEffects.None, 1f); //draws the title screen spriteBatch.End(); // stops drawing break; case GameState.Playing: map.Draw(spriteBatch); //draws the map p1.Draw(spriteBatch); //draws the player spriteBatch.DrawString(playerfont, name + " " + hp, new Vector2(p1.rect.X, p1.rect.Y - 20), Color.White); // draws the updated player health enemyM.Draw(spriteBatch); //draws the enemy spriteBatch.End(); break; } base.Draw(gameTime); }