Example #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public Isometry(IsometricStyle isoStyle, string mouseBitmap)
        {
            Style = isoStyle;
            var mouseMap = new Bitmap(mouseBitmap);
            _tileHeight = mouseMap.Height;
            _tileWidth = mouseMap.Width;
            ScreenAnchor = new Point(0, 0);

            //  Create the lookup table from the mouseMap bitmap
            _lookupTable = new MouseMappings[mouseMap.Width, mouseMap.Height];

            var nw = mouseMap.GetPixel(0, 0);
            var ne = mouseMap.GetPixel(mouseMap.Width - 1, 0);
            var sw = mouseMap.GetPixel(0, mouseMap.Height - 1);
            var se = mouseMap.GetPixel(mouseMap.Width - 1, mouseMap.Height - 1);

            for (var x = 0; x < mouseMap.Width; x++)
                for (var y = 0; y < mouseMap.Height; y++)
                {
                    var toTest = mouseMap.GetPixel(x, y);
                    if (toTest == nw)
                        _lookupTable[x, y] = MouseMappings.NW;
                    else if (toTest == ne)
                        _lookupTable[x, y] = MouseMappings.NE;
                    else if (toTest == se)
                        _lookupTable[x, y] = MouseMappings.SE;
                    else if (toTest == sw)
                        _lookupTable[x, y] = MouseMappings.SW;
                    else
                        _lookupTable[x, y] = MouseMappings.Center;
                }
            mouseMap.Dispose();
        }
Example #2
0
 /// <summary>
 /// Starts a new module.
 /// </summary>
 /// <param name="width"></param>
 /// <param name="height"></param>
 internal void NewModule(int width, int height, IsometricStyle style)
 {
     _currentUndoNode = null;
     Map.ClearAllCells(width, height);
     foreach( FactionList fl in Factions)
         fl.Units.Clear();
     Map.Iso.Style = style;
     ThreadPool.QueueUserWorkItem(MapCanvas.RenderMap, null);
 }