/// <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; }
internal static WWTexture FromRawData(int width, int height, byte[] data) { WWTexture tex = new WWTexture(width, height); tex.SetData(data); return(tex); }
internal UIImage(WWTexture setImage) { image = setImage; if (image != null) { Width = image.Width; Height = image.Height; } }
public override void Dispose() { if (minimapTex != null) { minimapTex.Dispose (); minimapTex = null; } base.Dispose (); }
public Cursor(CursorResource res) { HotSpotX = res.HotSpotX; HotSpotY = res.HotSpotY; Texture = WWTexture.FromCursorResource(res); }
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"); }
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); }
internal void Init() { minimapTex = WWTexture.FromRawData (Width, Height, null); }