Ejemplo n.º 1
0
        /// <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(
                SpriteSortMode.Deferred, //Use deferred instead of texture to render in order of .Draw() calls
                null, SamplerState.PointClamp, null, null, null, mapCamera.GetCameraMatrix());

            //Draw tiles in Map Grid
            foreach (MapObject[,] layer in gameMap.GetGameGrid())
            {
                foreach (MapObject tile in layer)
                {
                    if (tile != null)
                        tile.Draw(spriteBatch);
                }
            }

            //Draw map cursor
            gameMap.GetMapCursor().Draw(spriteBatch);

            base.Draw(gameTime);

            spriteBatch.End();
        }