/// <summary> /// Renders the node /// </summary> /// <param name="gameTime">Game Time</param> /// <param name="batch">Batch used to render the sprite if desired</param> /// <param name="renderer">System renderer</param> public virtual void Render(GameTime gameTime, SpriteBatch batch, Renderer renderer) { }
SoundEffectInstance _testSoundInstance; // Test sound effect instance #endregion Fields #region Constructors /// <summary> /// Constructor /// </summary> public Game1() { graphics = new GraphicsDeviceManager(this); _renderer = new Renderer(graphics); Content.RootDirectory = "Content"; }
/// <summary> /// Renders the sprite /// </summary> /// <param name="gameTime">Game time</param> /// <param name="batch">SpriteBatch to draw the sprite</param> /// <param name="renderer">The system Renderer</param> /// <param name="position">The position </param> public override void Render(GameTime gameTime, SpriteBatch batch, Renderer renderer, Vector2 position) { Tuple<int, int> frame = CurrentFrame; int row = frame.Item1; int column = frame.Item2; Rectangle destination = new Rectangle((int)position.X, (int)position.Y, Width, Height); Rectangle source = new Rectangle(Width * column, Height * row, Width, Height); batch.Draw(Texture, destination, source, Color.White); }
/// <summary> /// Renders the player /// </summary> /// <param name="gameTime">Game Time</param> /// <param name="batch">Batch used to render the sprite</param> public override void Render(GameTime gameTime, SpriteBatch batch, Renderer renderer) { Vector2 renderPosition = renderer.YCoordinateFlip(_position); renderPosition.Y -= _sprite.Height; _sprite.Render(gameTime, batch, renderer, renderPosition); base.Render(gameTime, batch, renderer); }
/// <summary> /// Renders the background /// </summary> /// <param name="gameTime">Game Time</param> /// <param name="batch">Batch used to render the sprite</param> public void Render(GameTime gameTime, SpriteBatch batch, Renderer renderer) { Vector2 renderPosition = renderer.YCoordinateFlip(new Vector2(0.0f, 0.0f)); renderPosition.Y -= _sprite.Height; batch.Draw(_sprite.Texture, new Rectangle((int)renderPosition.X, (int)renderPosition.Y, _sprite.Width, _sprite.Height), Color.White); }
/// <summary> /// Renders the sprite /// </summary> /// <param name="gameTime">Game time</param> /// <param name="batch">SpriteBatch to draw the sprite</param> /// <param name="renderer">The system Renderer</param> /// <param name="position">The position </param> public virtual void Render(GameTime gameTime, SpriteBatch batch, Renderer renderer, Vector2 position) { batch.Draw(Texture, new Rectangle((int)position.X, (int)position.Y, Width, Height), Color.White); }