/// <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); GraphicsDevice.Textures[0] = null; // TODO: Add your drawing code here foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); using (SpriteBatch sb = new SpriteBatch(GraphicsDevice)) { sb.Begin(); map.Draw(sb); foreach (var creature in creatureList) { (creature as Interfaces.IDrawable).Draw(sb); } sb.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) { GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here spriteBatch.Begin(); map.Draw(spriteBatch, new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height), viewportPosition); 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) { GraphicsDevice.Clear(Color.Black); // TODO: Add your drawing code here spriteBatch.Begin(); map.Draw(); puzzle.Draw(); 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) { GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(transformMatrix: camera.get_transformation(GraphicsDevice)); Map.Draw(); //camera.Draw(spriteBatch); spriteBatch.End(); //UpdateEventMouse(); Map.EnteredTile(); // TODO: Add your drawing code here Desktop.Render(); 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) { GraphicsDevice.Clear(Color.CornflowerBlue); var viewMatrix = camera.GetViewMatrix(); camera.Position = camPos; camera.Rotation = rotation; camera.Zoom = zoom; if (CurrentGameState == GameState.MainMenu) { spriteBatch.Begin(); spriteBatch.Draw(background, mainframe, Color.White); //spriteBatch.DrawString(font, "press enter to start ", new Vector2(0, 0), Color.Black, 0, new Vector2(0, 0),2 , 0, 0); spriteBatch.DrawString(font, "press enter to start", new Vector2((GraphicsDevice.Viewport.Width / 2) - 150, 375), Color.Black); spriteBatch.End(); } else if (CurrentGameState == GameState.PlayingLvl1) { #region GameLvl1; spriteBatch.Begin(); spriteBatch.Draw(background, mainframe, Color.White); spriteBatch.DrawString(font, "Score: " + _hero.Score, new Vector2(750, 0), Color.Black); spriteBatch.DrawString(font, "Hero Life: x" + _hero.HeroLife, new Vector2(0, 0), Color.Black); spriteBatch.End(); spriteBatch.Begin(transformMatrix: viewMatrix); exit_Lvl1.Draw(spriteBatch); _hero.Draw(spriteBatch); fire.Draw(spriteBatch); foreach (coin coin in coins) { coin.Draw(spriteBatch); } foreach (Enemy enemy in _Enemys) { if (enemy.isAlive) { enemy.Draw(spriteBatch); } } foreach (BulletRight Bullet in bulletsright) { Bullet.Draw(spriteBatch); } foreach (BulletLeft Bullet in bulletsleft) { Bullet.Draw(spriteBatch); } map.Draw(spriteBatch); foreach (MovingTiles tile in movingTiles) { tile.Draw(spriteBatch); } spriteBatch.End(); #endregion } else if (CurrentGameState == GameState.PlayingSecretLvl) { spriteBatch.Begin(); spriteBatch.Draw(background, mainframe, Color.White); spriteBatch.DrawString(font, "Score: " + _hero.Score, new Vector2(750, 0), Color.Black); spriteBatch.DrawString(font, "Hero Life: x" + _hero.HeroLife, new Vector2(0, 0), Color.Black); spriteBatch.End(); spriteBatch.Begin(); exit_SecretLvl.Draw(spriteBatch); _hero.Draw(spriteBatch); SecretLvl.Draw(spriteBatch); foreach (coin coin in coins_SecretLvl) { coin.Draw(spriteBatch); } spriteBatch.End(); } else if (CurrentGameState == GameState.PlayingLvl2) { spriteBatch.Begin(); spriteBatch.Draw(background, mainframe, Color.White); spriteBatch.DrawString(font, "Score: " + _hero.Score, new Vector2(750, 0), Color.Black); spriteBatch.DrawString(font, "Hero Life: x" + _hero.HeroLife, new Vector2(0, 0), Color.Black); spriteBatch.End(); spriteBatch.Begin(transformMatrix: viewMatrix); _hero.Draw(spriteBatch); foreach (MovingTiles tile in movingTiles_Lvl2) { tile.Draw(spriteBatch); } foreach (Enemy enemy in _EnemysLvl2) { if (enemy.isAlive) { enemy.Draw(spriteBatch); } } foreach (BulletRight Bullet in bulletsright) { Bullet.Draw(spriteBatch); } foreach (BulletLeft Bullet in bulletsleft) { Bullet.Draw(spriteBatch); } foreach (BulletEnemy Bullet in bulletEnemy) { Bullet.Draw(spriteBatch); } foreach (coin coin in coins_Lvl2) { coin.Draw(spriteBatch); } if (damageEndBoss < 20) { endBoss.Draw(spriteBatch); } else { exit_Lvl2.Draw(spriteBatch); } foreach (Kanon kanon in Kannonen) { kanon.Draw(spriteBatch); } map_Lvl2.Draw(spriteBatch); spriteBatch.End(); } else if (CurrentGameState == GameState.Dead) { spriteBatch.Begin(); spriteBatch.Draw(background, mainframe, Color.White); spriteBatch.DrawString(font, "Game Over!", new Vector2(650, 200), Color.Black); spriteBatch.DrawString(font, "Your score: " + _hero.Score, new Vector2(650, 400), Color.Black); spriteBatch.End(); } else if (CurrentGameState == GameState.End) { spriteBatch.Begin(); spriteBatch.Draw(background, mainframe, Color.White); spriteBatch.DrawString(font, "Yes! You did it!", new Vector2(650, 200), Color.Black); spriteBatch.DrawString(font, "Your score: " + _hero.Score, new Vector2(650, 400), Color.Black); spriteBatch.End(); } base.Draw(gameTime); }
protected override void DrawWidget(IBatchedDrawingService drawingService) { viewportPosition = new Vector2(cameraObject.X - (g.PreferredBackBufferWidth / 2), cameraObject.Y - (g.PreferredBackBufferHeight / 2)); map.Draw(drawingService, new Rectangle(0, 0, drawingService.GraphicsDevice.Viewport.Width, drawingService.GraphicsDevice.Viewport.Height), viewportPosition); }