/// <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.AntiqueWhite); // TODO: Add your drawing code here spriteBatch.Begin(); if (menu.GetStates() == Menu.CHOOSE) { menu.Draw(spriteBatch); } else if (menu.GetStates() == Menu.GAMESTART) { if (!table.IsInit) { table.Init(); } table.Draw(spriteBatch); } DrawCursor(); spriteBatch.End(); base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // Прописываем в методе Draw наше меню if (gameState == GameState.Game) { DrawGame(); } else { menu.Draw(spriteBatch); } 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) { // TODO: Add your drawing code here GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); spriteBatch.Draw(Background, pos1, null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0); spriteBatch.Draw(Background, pos1, null, Color.White, 0, new Vector2(0, 1920), 1, SpriteEffects.None, 0); spriteBatch.Draw(Frontground, pos2, null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0); spriteBatch.Draw(Frontground, pos2, null, Color.White, 0, new Vector2(0, 600), 1, SpriteEffects.None, 0); spriteBatch.End(); if (gameState == GameState.Game) { spriteBatch.Begin(); //подложка(черный фон) spriteBatch.Draw(Background, pos1, null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0); spriteBatch.Draw(Background, pos1, null, Color.White, 0, new Vector2(0, 1920), 1, SpriteEffects.None, 0); //первый слой звезд spriteBatch.Draw(Frontground, pos2, null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0); spriteBatch.Draw(Frontground, pos2, null, Color.White, 0, new Vector2(0, 600), 1, SpriteEffects.None, 0); //второй слой звезд spriteBatch.Draw(Frontground, pos3, null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0); spriteBatch.Draw(Frontground, pos3, null, Color.White, 0, new Vector2(0, 600), 1, SpriteEffects.None, 0); //кораблик spriteBatch.Draw(SpaceShipModel, new Vector2(SpaceShip.PositionX, SpaceShip.PositionY), Color.White); //bang.Draw(spriteBatch); KeyboardState state = Keyboard.GetState(); //if(state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.K)) //AnimatedBang.Draw(spriteBatch); alive.Draw(spriteBatch, Content); unalive.Draw(spriteBatch, Content); spriteBatch.End(); } else { menu.Draw(spriteBatch); } base.Draw(gameTime); }