Пример #1
0
        public SortVisualizer(Dataset data, DatasetOrderer orderer, DatasetSorter sorter, Rectangle bounds, DataBarTexture texture)
        {
            Data  = data;
            Order = orderer;
            Sort  = sorter;

            Bounds  = bounds;
            Texture = texture;

            RecordOrderSort();
        }
Пример #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            dataBarTexture = Content.Load <Texture2D>("dataBar2");
            dataBarTxtr    = new DataBarTexture(dataBarTexture, 4, 4);

            Rectangle viewportBounds = GraphicsDevice.Viewport.Bounds;

            Dataset data1 = new Dataset(250, Distribution.LinearDistribution);
            Dataset data2 = new Dataset(250, Distribution.LinearDistribution);

            visualizer1 = new SortVisualizer(data1, Order.RandomOrder, Sort.GnomeSorter,
                                             new Rectangle(0, 0, viewportBounds.Width / 2, viewportBounds.Height), dataBarTxtr);
            visualizer2 = new SortVisualizer(data2, Order.RandomOrder, Sort.BubbleSorter,
                                             new Rectangle(viewportBounds.Width / 2, 0, viewportBounds.Width / 2, viewportBounds.Height), dataBarTxtr);
        }