Exemple #1
0
        /// <summary>
        /// Draws the tiles that make up the map.
        /// </summary>
        /// <param name="spBatch"></param>
        public static void DrawMap(SpriteBatch spBatch, int dimension)
        {
            MapDrawer.UpdateSpriteBatch(spBatch);
            List <Point2D> result = Culler.GetChunksInView();

            //Iterates over all the chunks that are within view of the client's screen.
            int length = result.Count;

            for (int i = 0; i < length; i++)
            {
                Point2D chunkCoordinates = result[i];

                if (chunkCoordinates.X != -1 && chunkCoordinates.Y != -1)
                {
                    Chunk chunk = World.GetChunk(dimension, chunkCoordinates.X, chunkCoordinates.Y);
                    RenderChunk(chunk, dimension);
                }
            }

            MapDrawer.RenderAll();
        }