예제 #1
0
파일: MapTile.cs 프로젝트: CAMongrel/WinWar
        /// <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;
        }
예제 #2
0
        internal static WWTexture FromRawData(int width, int height, byte[] data)
        {
            WWTexture tex = new WWTexture(width, height);

            tex.SetData(data);
            return(tex);
        }
예제 #3
0
파일: UIImage.cs 프로젝트: CAMongrel/WinWar
        internal UIImage(WWTexture setImage)
        {
            image = setImage;

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

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

             Texture = WWTexture.FromCursorResource(res);
        }
예제 #6
0
파일: Texture.cs 프로젝트: CAMongrel/WinWar
 internal static WWTexture FromRawData(int width, int height, byte[] data)
 {
     WWTexture tex = new WWTexture (width, height);
      tex.SetData (data);
      return tex;
 }
예제 #7
0
 internal MenuBackgroundWindow()
 {
     backgroundImage = WWTexture.FromImageResource("Mainmenu Background");
 }
예제 #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);
        }
예제 #9
0
 internal void Init()
 {
     minimapTex = WWTexture.FromRawData (Width, Height, null);
 }