/// <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) { frameCounter++; string fps = string.Format("fps: {0}", frameRate); // Draw the safe area borders. Color translucentRed = Color.Red * 0.5f; GraphicsDevice.Clear(Color.CornflowerBlue); //spriteBatch.Begin(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, cam.getTransformation(GraphicsDevice /*Send the variable that has your graphic device here*/)); // spriteBatch.Draw(dummyTexture, test, translucentRed); if (mode == "player") { player1.Draw(spriteBatch); } else { player1.ProjectileA.Draw(spriteBatch); } projectileManager.drawAllProjectiles(spriteBatch); string health = string.Format("Move: {0}", player1.Sprite.CurrentAnimation); spriteBatch.DrawString(spriteFont, fps, new Vector2(33, 33), Color.Black); spriteBatch.DrawString(spriteFont, fps, new Vector2(32, 32), Color.White); spriteBatch.DrawString(spriteFont, health, new Vector2(50, 50), Color.Black); if (hitbox != null) { string hitboxData = string.Format("Hitbox {5} : {4} : {0} {1} {2} {3}", hitbox.XPos, hitbox.YPos, hitbox.Width, hitbox.Height, move.CurrentFrame, player1.Sprite.CurrentAnimation); spriteBatch.DrawString(spriteFont, hitboxData, new Vector2(50, 110), Color.Black); } if (hurtboxInfo != null) { string hurtboxData = string.Format("Hurtbox {5} : {4} : {0} {1} {2} {3}", hurtboxInfo.XPos, hurtboxInfo.YPos, hurtboxInfo.Width, hurtboxInfo.Height, move.CurrentFrame, player1.Sprite.CurrentAnimation); spriteBatch.DrawString(spriteFont, hurtboxData, new Vector2(50, 80), Color.Black); } spriteBatch.End(); spriteBatch.Begin(); spriteBatch.DrawString(spriteFont, roundManager.displayTime(), new Vector2(500, 30), Color.Black); spriteBatch.DrawString(spriteFont, roundManager.displayTime(), new Vector2(501, 31), Color.White); comboManager.displayComboMessage(spriteBatch); spriteBatch.End(); base.Draw(gameTime); }
/// <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) { frameCounter++; string fps = string.Format("fps: {0}", frameRate); // Draw the safe area borders. Color translucentRed = Color.Red * 0.5f; GraphicsDevice.Clear(Color.CornflowerBlue); if (gameState == GameState.MAINMENU) { spriteBatch.Begin(); // Color black2 = Color.Black * .5f; spriteBatch.Draw(titleScreen, new Rectangle(0, 0, Config.Instance.ScreenWidth, Config.Instance.ScreenHeight), Color.White); mainMenu.Draw(spriteBatch); spriteBatch.End(); } if (gameState == GameState.PLAYERSELECT) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, cam.getTransformation(GraphicsDevice /*Send the variable that has your graphic device here*/)); spriteBatch.Draw(menuBg, new Rectangle(0, 0, Config.Instance.ScreenWidth, Config.Instance.ScreenHeight), Color.White); characterSelection.Draw(spriteBatch); spriteBatch.End(); } if (gameState == GameState.LOADING) { spriteBatch.Begin(); spriteBatch.Draw(loadingScreen, new Rectangle(0, 0, Config.Instance.ScreenWidth, Config.Instance.ScreenHeight), Color.White); spriteBatch.End(); } if (gameState == GameState.PLAYING || gameState == GameState.ROUNDEND || gameState == GameState.PAUSED) { //spriteBatch.Begin(); foreach (Layer layer in layers) { layer.Draw(spriteBatch); } spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, cam.getTransformation(GraphicsDevice /*Send the variable that has your graphic device here*/)); if (superManager.isDrawingSuperFreeze()) { superManager.drawSuperEffects(spriteBatch, background, mainFrame); if (superManager.isInSuperFreeze()) { // projectileManager.drawPortrait(spriteBatch); Color black2 = Color.Black * .5f; spriteBatch.Draw(dummyTexture, mainFrame, black2); } } else { //spriteBatch.Draw(background, mainFrame, Color.White); // spriteBatch.Draw(background2, mainFrame, Color.White); } // spriteBatch.Draw(dummyTexture, test, translucentRed); // spriteBatch.Draw(dummyTexture, testHitbox, translucentRed); player2.Draw(spriteBatch); player1.Draw(spriteBatch); projectileManager.drawAllProjectiles(spriteBatch); string health = string.Format("Health: {0}", player1.CurrentHealth); //spriteBatch.DrawString(spriteFont, fps, new Vector2(33, 33), Color.Black); //spriteBatch.DrawString(spriteFont, fps, new Vector2(32, 32), Color.White); //spriteBatch.DrawString(spriteFont, health, new Vector2(50, 50), Color.Black); spriteBatch.End(); spriteBatch.Begin(); spriteBatch.DrawString(ingameFont, roundManager.displayTime(), new Vector2(620, 20), Color.Black, 0, new Vector2(0, 0), 3, SpriteEffects.None, 0); spriteBatch.DrawString(ingameFont, roundManager.displayTime(), new Vector2(621, 21), Color.White, 0, new Vector2(0, 0), 3, SpriteEffects.None, 0); comboManager.displayComboMessage(spriteBatch); player1.DrawGauges(spriteBatch); player2.DrawGauges(spriteBatch); spriteBatch.Draw(player1NamePlate, new Rectangle(60, 75, 107, 70), Color.White); spriteBatch.Draw(player2NamePlate, new Rectangle(1100, 75, 107, 70), Color.White); if (roundManager.Player1RoundWins == 2) { spriteBatch.Draw(victoryDots, (new Vector2(500, 60)), new Rectangle(0, 100, 100, 100), Color.White, 0, new Vector2(0, 0), .25f, SpriteEffects.None, 0); spriteBatch.Draw(victoryDots, (new Vector2(540, 60)), new Rectangle(0, 100, 100, 100), Color.White, 0, new Vector2(0, 0), .25f, SpriteEffects.None, 0); } else if (roundManager.Player1RoundWins == 1) { spriteBatch.Draw(victoryDots, (new Vector2(500, 60)), new Rectangle(0, 100, 100, 100), Color.White, 0, new Vector2(0, 0), .25f, SpriteEffects.None, 0); } else { //spriteBatch.Draw(victoryDots, (new Vector2(500, 60)), // new Rectangle(0, 0, 100, 100), Color.White, // 0, new Vector2(0, 0), .25f, SpriteEffects.None, 0); //spriteBatch.Draw(victoryDots, (new Vector2(540, 40)), // new Rectangle(0, 100, 100, 100), Color.White, // 0, new Vector2(0, 0), .25f, SpriteEffects.None, 0); } if (roundManager.Player2RoundWins == 2) { spriteBatch.Draw(victoryDots, (new Vector2(705, 60)), new Rectangle(0, 100, 100, 100), Color.White, 0, new Vector2(0, 0), .25f, SpriteEffects.None, 0); spriteBatch.Draw(victoryDots, (new Vector2(745, 60)), new Rectangle(0, 100, 100, 100), Color.White, 0, new Vector2(0, 0), .25f, SpriteEffects.None, 0); } else if (roundManager.Player2RoundWins == 1) { spriteBatch.Draw(victoryDots, (new Vector2(705, 60)), new Rectangle(0, 100, 100, 100), Color.White, 0, new Vector2(0, 0), .25f, SpriteEffects.None, 0); } else { } Color black = Color.Black * roundManager.FadeAmount; spriteBatch.Draw(dummyTexture, mainFrame, black); spriteBatch.End(); // Have some pause drawing stuff // if (gameState == GameState.PAUSED) { spriteBatch.Begin(); Color black2 = Color.Black * .5f; spriteBatch.Draw(dummyTexture, mainFrame, black2); pauseMenu.Draw(spriteBatch); spriteBatch.End(); } } if (gameState == GameState.DEMOEND) { spriteBatch.Begin(); spriteBatch.Draw(demoEndScreen, new Rectangle(0, 0, Config.Instance.ScreenWidth, Config.Instance.ScreenHeight), Color.White); Color black = Color.Black * roundManager.FadeAmount; spriteBatch.Draw(dummyTexture, mainFrame, black); //spriteBatch.Draw(dummyTexture, mainFrame, black2); //spriteBatch.DrawString(spriteFont, "Thanks For Playing!", new Vector2(500, 300), Color.White, 0, new Vector2(0, 0), 3, SpriteEffects.None, 0); spriteBatch.End(); } base.Draw(gameTime); }