private void DrawGameInfo() { // draw game info GameContent.DrawText("Score : " + score, Color.Gray, GameContent.textposition.TopLeft, gamecontent.font_GoodDog, spritebatch, vwidth, vheight); GameContent.DrawText("Balls Left : " + ballsleft, Color.Gray, GameContent.textposition.TopRight, gamecontent.font_GoodDog, spritebatch, vwidth, vheight); GameContent.DrawText("Level " + level.number + " - " + level.name, Color.Green, GameContent.textposition.TopMiddle, gamecontent.font_arial, spritebatch, vwidth, vheight); }
public void Draw() { DrawGrid(); // draw Buttons spritebatch.Draw(gamecontent.button_load, new Vector2(width - ((gamecontent.button_load.Width + 5) * 4), height - gamecontent.button_load.Height - 5), Color.White); spritebatch.Draw(gamecontent.button_save, new Vector2(width - ((gamecontent.button_load.Width + 5) * 3), height - gamecontent.button_load.Height - 5), Color.White); spritebatch.Draw(gamecontent.button_test, new Vector2(width - ((gamecontent.button_load.Width + 5) * 2), height - gamecontent.button_load.Height - 5), Color.White); spritebatch.Draw(gamecontent.button_clear, new Vector2(width - ((gamecontent.button_load.Width + 5)), height - gamecontent.button_load.Height - 5), Color.White); if (button_hover > 0) { spritebatch.Draw(gamecontent.button_outline, new Vector2(width - ((gamecontent.button_load.Width + 5) * (5 - button_hover)), height - gamecontent.button_load.Height - 5), Color.White); } level.Draw(spritebatch); if (ongrid && !overblock) { GameContent.DrawText(level.cursor[cursorindex].editordesc, level.cursor[cursorindex].color, GameContent.textposition.BottomLeft, gamecontent.font_GoodDog, spritebatch, width, height); level.cursor[cursorindex].Draw(spritebatch); } else { if (overblock) { // selectedblock = level.blocks.Find(x => x.position.Equals(snapped)); GameContent.DrawText(selectedblock.editordesc, selectedblock.color, GameContent.textposition.BottomLeft, gamecontent.font_GoodDog, spritebatch, width, height); } else { GameContent.DrawText("Current Level : " + level.number, Color.White, GameContent.textposition.BottomLeft, gamecontent.font_GoodDog, spritebatch, width, height); } spritebatch.Draw(gamecontent.pointer, new Vector2(currentmousestate.X, currentmousestate.Y), Color.White); } }
/// <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.Black); spritebatch.Begin(); spritebatch.Draw(level.background, new Vector2(0, 0), null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); switch (currentstate) { case gamestate.MainMenu: GameContent.DrawText("Main Menu", Color.MonoGameOrange, GameContent.textposition.TopMiddle, gamecontent.font_GoodDog, spritebatch, vwidth, vheight); break; case gamestate.Editor: editor.Draw(); break; case gamestate.WaitingBall: level.paddle.Draw(spritebatch); level.Draw(spritebatch); DrawGameInfo(); GameContent.DrawText("Left Click to Launch Ball", Color.MonoGameOrange, GameContent.textposition.BottomRight, gamecontent.font_GoodDog, spritebatch, vwidth, vheight); break; case gamestate.BallLaunched: level.paddle.Draw(spritebatch); level.Draw(spritebatch); DrawGameInfo(); break; case gamestate.GameOver: level.Draw(spritebatch); GameContent.DrawText("Game Over", Color.Red, GameContent.textposition.Middle, gamecontent.font_GoodDog, spritebatch, vwidth, vheight); DrawGameInfo(); break; } spritebatch.End(); base.Draw(gameTime); }