Exemple #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;
        }
Exemple #2
0
        internal static WWTexture FromRawData(int width, int height, byte[] data)
        {
            WWTexture tex = new WWTexture(width, height);

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

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

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

             Texture = WWTexture.FromCursorResource(res);
        }
Exemple #6
0
 internal static WWTexture FromRawData(int width, int height, byte[] data)
 {
     WWTexture tex = new WWTexture (width, height);
      tex.SetData (data);
      return tex;
 }
 internal MenuBackgroundWindow()
 {
     backgroundImage = WWTexture.FromImageResource("Mainmenu Background");
 }
Exemple #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);
        }
Exemple #9
0
 internal void Init()
 {
     minimapTex = WWTexture.FromRawData (Width, Height, null);
 }