Example #1
0
        /// <summary>
        /// Create tile
        /// </summary>
        internal MapTile(byte[] data)
        {
            if (data.Length != 256 * 4)
            throw new InvalidDataException("Wrong length of tile data array, must be 1024 bytes.");

             averageColor = Color.Black;

             texture = WWTexture.FromRawData(16, 16, data);

             int avgR = 0;
             int avgG = 0;
             int avgB = 0;

             // Calc average color
             for (int i = 0; i < 256; i += 4)
             {
            avgR += data[i + 0];
            avgG += data[i + 1];
            avgB += data[i + 2];
             }

             averageColor.R = (byte)(avgR / 64);
             averageColor.G = (byte)(avgG / 64);
             averageColor.B = (byte)(avgB / 64);
             averageColor.A = 255;
        }
Example #2
0
        internal static WWTexture FromRawData(int width, int height, byte[] data)
        {
            WWTexture tex = new WWTexture(width, height);

            tex.SetData(data);
            return(tex);
        }
Example #3
0
        internal UIImage(WWTexture setImage)
        {
            image = setImage;

             if (image != null)
             {
            Width = image.Width;
            Height = image.Height;
             }
        }
Example #4
0
        public override void Dispose()
        {
            if (minimapTex != null)
             {
            minimapTex.Dispose ();
            minimapTex = null;
             }

             base.Dispose ();
        }
Example #5
0
        public Cursor(CursorResource res)
        {
            HotSpotX = res.HotSpotX;
             HotSpotY = res.HotSpotY;

             Texture = WWTexture.FromCursorResource(res);
        }
Example #6
0
 internal static WWTexture FromRawData(int width, int height, byte[] data)
 {
     WWTexture tex = new WWTexture (width, height);
      tex.SetData (data);
      return tex;
 }
Example #7
0
 internal MenuBackgroundWindow()
 {
     backgroundImage = WWTexture.FromImageResource("Mainmenu Background");
 }
Example #8
0
        private void AutoSetButtonImage(int releaseButtonResourceIndex, int pressedButtonResourceIndex)
        {
            backgroundNotClicked = WWTexture.FromImageResource(WarFile.GetImageResource(releaseButtonResourceIndex));
             backgroundClicked = WWTexture.FromImageResource(WarFile.GetImageResource(pressedButtonResourceIndex));

             Width = (int)(backgroundNotClicked.Width);
             Height = (int)(backgroundNotClicked.Height);
        }
Example #9
0
 internal void Init()
 {
     minimapTex = WWTexture.FromRawData (Width, Height, null);
 }