Ejemplo n.º 1
0
        public MapControl4()
        {
            m_drawingCache       = new DrawingCache();
            m_symbolDrawingCache = new SymbolDrawingCache(m_drawingCache);
            m_symbolBitmapCache  = new SymbolBitmapCache(m_symbolDrawingCache, m_tileSize);

            m_map = new Map(512, 512);
            for (int y = 0; y < m_map.Height; ++y)
            {
                for (int x = 0; x < m_map.Width; ++x)
                {
                    m_map.MapArray[y, x] = (x + (y % 2)) % 2 == 0 ? (byte)50 : (byte)255;
                }
            }

            m_bmpArray = new BitmapSource[10];
            for (int i = 0; i < 10; ++i)
            {
                m_bmpArray[i] = m_symbolBitmapCache.GetBitmap((SymbolID)i, Colors.Black, false);
            }


            m_mcd2d = new TileControlD2D();
            m_mcd2d.SetSymbolBitmaps(m_bmpArray, m_tileSize);
            AddChild(m_mcd2d);
        }
Ejemplo n.º 2
0
        public MapControl3()
        {
            m_drawingCache       = new DrawingCache();
            m_symbolDrawingCache = new SymbolDrawingCache(m_drawingCache);
            m_symbolBitmapCache  = new SymbolBitmapCache(m_symbolDrawingCache, m_tileSize);

            m_map = new Map(512, 512);
            for (int y = 0; y < m_map.Height; ++y)
            {
                for (int x = 0; x < m_map.Width; ++x)
                {
                    m_map.MapArray[y, x] = (x + (y % 2)) % 2 == 0 ? (byte)50 : (byte)255;
                }
            }
        }
Ejemplo n.º 3
0
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);

            tileControl.AboutToRender     += tileControl_AboutToRender;
            tileControl.TileLayoutChanged += tileControl_TileArrangementChanged;

            var symbolDrawingCache = new SymbolDrawingCache(new Uri("/Symbols/SymbolInfosGfx.xaml", UriKind.Relative));

            tileControl.SymbolDrawingCache = symbolDrawingCache;

            m_renderData = new RenderData <RenderTileDetailed>();
            tileControl.SetRenderData(m_renderData);
            tileControl.TileSize = 32;
            m_targetTileSize     = tileControl.TileSize;

            this.MouseWheel += new MouseWheelEventHandler(MainWindow_MouseWheel);
            this.KeyDown    += new KeyEventHandler(MainWindow_KeyDown);

            CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);
            m_timer = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Normal, OnTimerCallback, this.Dispatcher);
        }