protected override void ProcessStyle(GUIStyle style) { base.ProcessStyle(style); ImageNode normal = style.GetNodeByName("Crosshair").GetNodeByName("Normal"); this.m_position.X -= normal.Rectangle.Width / 2; this.m_position.Y -= normal.Rectangle.Height / 2; this.m_size = normal.Rectangle.Size; float tWidth=style.ImageInfo.Width; float tHeight=style.ImageInfo.Height; CustomVertex.TransformedColoredTextured topleft, topright, bottomleft, bottomright; //topLeft=new CustomVertex.TransformedColoredTextured(m_position.X,m_position.Y+normal.Rectangle.Height,0,1,normal.Color.ToArgb(), ImageNode i = normal; RectangleF rect = normal.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y , 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + rect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + rect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + rect.Width, m_position.Y + rect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); normalQuad = new Quad(topleft, topright, bottomleft, bottomright); }
protected override void ProcessStyle(GUIStyle style) { base.ProcessStyle(style); ImageNode normal, over, down, disabled, mark; normal = style.GetNodeByName("RadioButton").GetNodeByName("Normal"); over = style.GetNodeByName("RadioButton").GetNodeByName("Over"); down = style.GetNodeByName("RadioButton").GetNodeByName("Down"); disabled = style.GetNodeByName("RadioButton").GetNodeByName("Disabled"); mark = style.GetNodeByName("RadioButton").GetNodeByName("RadioMark"); float tWidth = (float)style.ImageInfo.Width; float tHeight = (float)style.ImageInfo.Height; //Positioning Quads ImageNode i; RectangleF rect; CustomVertex.TransformedColoredTextured topleft, topright, bottomleft, bottomright; //normal i = normal; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + m_size.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + m_size.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + m_size.Width, m_position.Y + m_size.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //over i = over; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + m_size.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + m_size.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + m_size.Width, m_position.Y + m_size.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_overBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //down i = down; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + m_size.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + m_size.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + m_size.Width, m_position.Y + m_size.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_downBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //disabled i = disabled; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + m_size.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + m_size.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + m_size.Width, m_position.Y + m_size.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //mark i = mark; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + m_size.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + m_size.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + m_size.Width, m_position.Y + m_size.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_checkMarkQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); foreach (Quad q in m_normalBoxQuads) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } foreach (Quad q in m_overBoxQuads) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } foreach (Quad q in m_downBoxQuads) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } foreach (Quad q in m_disabledBoxQuads) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } foreach (Quad q in m_checkMarkQuads) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } }
protected override void ProcessStyle(GUIStyle style) { base.ProcessStyle(style); ImageNode bottomB, leftB, rightB, topB, trC, tlC, brC, blC, windowBg, cursor; bottomB = style.GetNodeByName("EditBox").GetNodeByName("NormalBottomBorder"); topB = style.GetNodeByName("EditBox").GetNodeByName("NormalTopBorder"); leftB = style.GetNodeByName("EditBox").GetNodeByName("NormalLeftBorder"); rightB = style.GetNodeByName("EditBox").GetNodeByName("NormalRightBorder"); trC = style.GetNodeByName("EditBox").GetNodeByName("NormalTopRightCorner"); tlC = style.GetNodeByName("EditBox").GetNodeByName("NormalTopLeftCorner"); brC = style.GetNodeByName("EditBox").GetNodeByName("NormalBottomRightCorner"); blC = style.GetNodeByName("EditBox").GetNodeByName("NormalBottomLeftCorner"); windowBg = style.GetNodeByName("EditBox").GetNodeByName("NormalBackground"); cursor = style.GetNodeByName("EditBox").GetNodeByName("NormalCursor"); float left, right, top, bottom; left = leftB.Rectangle.Width; right = rightB.Rectangle.Width; top = topB.Rectangle.Height; bottom = bottomB.Rectangle.Height; m_textRect = new RectangleF(); m_textRect.X = m_position.X + left; m_textRect.Y = m_position.Y + top; m_textRect.Width = m_size.Width - left - right; m_textRect.Height = m_size.Height - top - bottom; float line_width = GM.FontManager.GetFont(FontName, m_fontSize).GetStringWidth(m_text, m_fontSize, true); m_cursorPos = new PointF(m_textRect.X + line_width, m_textRect.Y); m_cursorOffset = m_text.Length; //m_cursorOffset = 0; float cursorH, cursorW; cursorW = cursor.Rectangle.Width; cursorH = m_fontSize; float tWidth = (float)style.ImageInfo.Width; float tHeight = (float)style.ImageInfo.Height; //Positioning Quads ImageNode i; RectangleF rect; CustomVertex.TransformedColoredTextured topleft, topright, bottomleft, bottomright; #region Normal Borders //leftBorder i = leftB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //topBorder i = topB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //rightBorder i = rightB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + m_textRect.Width + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width + right, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + m_textRect.Width + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width + right, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomBorder i = bottomB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion #region Normal Corners //topLeftCorner i = tlC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //topRightCorner i = trC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomRightCorner i = brC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomLeftCorner i = blC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion #region Normal Background & Cursor //WindowBackground i = windowBg; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_textRect.Left, m_textRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_textRect.Right, m_textRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_textRect.Left, m_textRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_textRect.Right, m_textRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //Cursor i = cursor; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_cursorPos.X, m_cursorPos.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_cursorPos.X + cursorW, m_cursorPos.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_cursorPos.X, m_cursorPos.Y + cursorH, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_cursorPos.X + cursorW, m_cursorPos.Y + cursorH, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_cursorQuad.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion bottomB = style.GetNodeByName("Button").GetNodeByName("DisabledBottomBorder"); topB = style.GetNodeByName("Button").GetNodeByName("DisabledTopBorder"); leftB = style.GetNodeByName("Button").GetNodeByName("DisabledLeftBorder"); rightB = style.GetNodeByName("Button").GetNodeByName("DisabledRightBorder"); trC = style.GetNodeByName("Button").GetNodeByName("DisabledTopRightCorner"); tlC = style.GetNodeByName("Button").GetNodeByName("DisabledTopLeftCorner"); brC = style.GetNodeByName("Button").GetNodeByName("DisabledBottomRightCorner"); blC = style.GetNodeByName("Button").GetNodeByName("DisabledBottomLeftCorner"); windowBg = style.GetNodeByName("Button").GetNodeByName("DisabledBackground"); #region Disabled Borders //leftBorder i = leftB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //topBorder i = topB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //rightBorder i = rightB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + m_textRect.Width + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width + right, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + m_textRect.Width + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width + right, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomBorder i = bottomB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion #region Disabled Corners //topLeftCorner i = tlC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //topRightCorner i = trC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomRightCorner i = brC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomLeftCorner i = blC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion #region Disabled Background //WindowBackground i = windowBg; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_textRect.Left, m_textRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_textRect.Right, m_textRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_textRect.Left, m_textRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_textRect.Right, m_textRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledBoxQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion foreach (Quad q in m_normalBoxQuads) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } foreach (Quad q in m_disabledBoxQuads) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } m_cursorQuad[0].X += m_positionDelta.X; m_cursorQuad[0].Y += m_positionDelta.Y; }
protected override void ProcessStyle(GUIStyle style) { base.ProcessStyle(style); ImageNode outline = style.GetNodeByName("Speedometer").GetNodeByName("Outline"); ImageNode bar = style.GetNodeByName("Speedometer").GetNodeByName("Bar"); ImageNode marker = style.GetNodeByName("Speedometer").GetNodeByName("Marker"); this.m_position.X -= outline.Rectangle.Width / 2; this.m_position.Y -= outline.Rectangle.Height / 2; this.m_size = outline.Rectangle.Size; float tWidth = style.ImageInfo.Width; float tHeight = style.ImageInfo.Height; CustomVertex.TransformedColoredTextured topleft, topright, bottomleft, bottomright; //topLeft=new CustomVertex.TransformedColoredTextured(m_position.X,m_position.Y+normal.Rectangle.Height,0,1,normal.Color.ToArgb(), ImageNode i = outline; RectangleF rect = outline.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + rect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + rect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + rect.Width, m_position.Y + rect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); outlineQuad = new Quad(topleft, topright, bottomleft, bottomright); i = bar; rect = bar.Rectangle; barQuadWidth = rect.Width; float deltax = (outline.Rectangle.Width - bar.Rectangle.Width) / 2; float deltay = (outline.Rectangle.Height - bar.Rectangle.Height) / 2; barQuadStart = m_position.X + deltax; barQuadUWidth = (rect.Width) / tWidth; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + deltax, m_position.Y + deltay, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + rect.Width + deltax, m_position.Y + deltay, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + deltax, m_position.Y + rect.Height + deltay, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + rect.Width + deltax, m_position.Y + rect.Height + deltay, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); barQuad = new AdjustableQuad(topleft, topright, bottomleft, bottomright); i = marker; rect = marker.Rectangle; deltax = (outline.Rectangle.Width - bar.Rectangle.Width) / 2 - marker.Rectangle.Width / 2; deltay = -marker.Rectangle.Height; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + deltax, m_position.Y + deltay, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + rect.Width + deltax, m_position.Y + deltay, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + deltax, m_position.Y + rect.Height + deltay, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + rect.Width + deltax, m_position.Y + rect.Height + deltay, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); markerQuad = new Quad(topleft, topright, bottomleft, bottomright); }
protected override void ProcessStyle(GUIStyle style) { base.ProcessStyle(style); ImageNode map = style.GetNodeByName("Map").GetNodeByName("Map"); ImageNode ass = style.GetNodeByName("Map").GetNodeByName("Assassin"); ImageNode kni = style.GetNodeByName("Map").GetNodeByName("Knight"); this.m_size = new SizeF(map.Rectangle.Size.Width * 2, map.Rectangle.Size.Height * 2); this.m_position.X -= m_size.Width / 2; this.m_position.Y -= m_size.Height / 2; float tWidth = style.ImageInfo.Width; float tHeight = style.ImageInfo.Height; CustomVertex.TransformedColoredTextured topleft, topright, bottomleft, bottomright; //topLeft=new CustomVertex.TransformedColoredTextured(m_position.X,m_position.Y+normal.Rectangle.Height,0,1,normal.Color.ToArgb(), ImageNode i = map; RectangleF rect = map.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + m_size.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + m_size.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + m_size.Width, m_position.Y + m_size.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); mapQuad = new Quad(topleft, topright, bottomleft, bottomright); i = ass; rect = ass.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + rect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + rect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + rect.Width, m_position.Y + rect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); assassinQuad = new Quad(topleft, topright, bottomleft, bottomright); i = kni; rect = kni.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + rect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + rect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + rect.Width, m_position.Y + rect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); knightQuad = new Quad(topleft, topright, bottomleft, bottomright); }
/// <summary> /// Sets current style, which can be obtained by calling GetCurrentStyle(). /// </summary> /// <param name="style">Style object to be set as current</param> public void SetCurrentStyle(GUIStyle style) { for (int i = 0; i < m_styles.Count; i++) { if (m_styles[i] == style) { m_current = i; } } }
protected override void ProcessStyle(GUIStyle style) { base.ProcessStyle(style); ImageNode bottomB, leftB, rightB, topB, trC, tlC, brC, blC, windowBg, titleBg; bottomB = style.GetNodeByName("Window").GetNodeByName("BottomBorder"); topB = style.GetNodeByName("Window").GetNodeByName("TopBorder"); leftB = style.GetNodeByName("Window").GetNodeByName("LeftBorder"); rightB = style.GetNodeByName("Window").GetNodeByName("RightBorder"); trC = style.GetNodeByName("Window").GetNodeByName("TopRightCorner"); tlC = style.GetNodeByName("Window").GetNodeByName("TopLeftCorner"); brC = style.GetNodeByName("Window").GetNodeByName("BottomRightCorner"); blC = style.GetNodeByName("Window").GetNodeByName("BottomLeftCorner"); windowBg = style.GetNodeByName("Window").GetNodeByName("Background"); titleBg = style.GetNodeByName("Window").GetNodeByName("TitleBackground"); float left, right, top, bottom, title; left = leftB.Rectangle.Width; right = rightB.Rectangle.Width; top = topB.Rectangle.Height; bottom = bottomB.Rectangle.Height; title = DefaultValues.TitleTextSize; m_usableRect = new RectangleF(); m_usableRect.X = m_position.X + left; m_usableRect.Y = m_position.Y + top + title; m_usableRect.Width = m_size.Width - left - right; m_usableRect.Height = m_size.Height - top - title - bottom; m_titleRect = new RectangleF(); m_titleRect.X = m_position.X + left; m_titleRect.Y = m_position.Y + top; m_titleRect.Width = m_size.Width - left - right; m_titleRect.Height = title; float tWidth = (float)style.ImageInfo.Width; float tHeight = (float)style.ImageInfo.Height; //Positioning Quads ImageNode i; RectangleF rect; CustomVertex.TransformedColoredTextured topleft, topright, bottomleft, bottomright; #region Borders //leftBorder i = leftB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_windowQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //topBorder i = topB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_usableRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_usableRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_windowQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //rightBorder i = rightB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + m_usableRect.Width + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_usableRect.Width + right, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + m_usableRect.Width + left, m_position.Y + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_usableRect.Width + right, m_position.Y + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_windowQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomBorder i = bottomB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_usableRect.Width, m_position.Y + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + bottom + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_usableRect.Width, m_position.Y + bottom + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_windowQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion #region Corners //topLeftCorner i = tlC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_windowQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //topRightCorner i = trC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_usableRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_usableRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_usableRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_usableRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_windowQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomRightCorner i = brC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_usableRect.Width, m_position.Y + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_usableRect.Width, m_position.Y + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_usableRect.Width, m_position.Y + bottom + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_usableRect.Width, m_position.Y + bottom + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_windowQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomLeftCorner i = blC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + bottom + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + bottom + top + m_usableRect.Height + m_titleRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_windowQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion #region Backgrounds //WindowBackground i = windowBg; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_usableRect.Left, m_usableRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_usableRect.Right, m_usableRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_usableRect.Left, m_usableRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_usableRect.Right, m_usableRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_windowQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //TitleBackground i = titleBg; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_titleRect.Left, m_titleRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_titleRect.Right, m_titleRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_titleRect.Left, m_titleRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_titleRect.Right, m_titleRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_windowQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion }
/// <summary> /// Processes a GUIStyle object /// </summary> /// <param name="style"></param> protected virtual void ProcessStyle(GUIStyle style) { m_styleName = style.Name; FontName = style.FontName; }
protected override void ProcessStyle(GUIStyle style) { base.ProcessStyle(style); ImageNode bottomB, leftB, rightB, topB, trC, tlC, brC, blC, windowBg; bottomB = style.GetNodeByName("Button").GetNodeByName("NormalBottomBorder"); topB = style.GetNodeByName("Button").GetNodeByName("NormalTopBorder"); leftB = style.GetNodeByName("Button").GetNodeByName("NormalLeftBorder"); rightB = style.GetNodeByName("Button").GetNodeByName("NormalRightBorder"); trC = style.GetNodeByName("Button").GetNodeByName("NormalTopRightCorner"); tlC = style.GetNodeByName("Button").GetNodeByName("NormalTopLeftCorner"); brC = style.GetNodeByName("Button").GetNodeByName("NormalBottomRightCorner"); blC = style.GetNodeByName("Button").GetNodeByName("NormalBottomLeftCorner"); windowBg = style.GetNodeByName("Button").GetNodeByName("NormalBackground"); float left, right, top, bottom; left = leftB.Rectangle.Width; right = rightB.Rectangle.Width; top = topB.Rectangle.Height; bottom = bottomB.Rectangle.Height; m_textRect = new RectangleF(); m_textRect.X = m_position.X + left; m_textRect.Y = m_position.Y + top; m_textRect.Width = m_size.Width - left - right; m_textRect.Height = m_size.Height - top - bottom; float tWidth = (float)style.ImageInfo.Width; float tHeight = (float)style.ImageInfo.Height; //Positioning Quads ImageNode i; RectangleF rect; CustomVertex.TransformedColoredTextured topleft, topright, bottomleft, bottomright; #region Normal Borders //leftBorder i = leftB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //topBorder i = topB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //rightBorder i = rightB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + m_textRect.Width + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width + right, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + m_textRect.Width + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width + right, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomBorder i = bottomB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion #region Normal Corners //topLeftCorner i = tlC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //topRightCorner i = trC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomRightCorner i = brC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomLeftCorner i = blC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion #region Normal Background //WindowBackground i = windowBg; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_textRect.Left, m_textRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_textRect.Right, m_textRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_textRect.Left, m_textRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_textRect.Right, m_textRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion bottomB = style.GetNodeByName("Button").GetNodeByName("OverBottomBorder"); topB = style.GetNodeByName("Button").GetNodeByName("OverTopBorder"); leftB = style.GetNodeByName("Button").GetNodeByName("OverLeftBorder"); rightB = style.GetNodeByName("Button").GetNodeByName("OverRightBorder"); trC = style.GetNodeByName("Button").GetNodeByName("OverTopRightCorner"); tlC = style.GetNodeByName("Button").GetNodeByName("OverTopLeftCorner"); brC = style.GetNodeByName("Button").GetNodeByName("OverBottomRightCorner"); blC = style.GetNodeByName("Button").GetNodeByName("OverBottomLeftCorner"); windowBg = style.GetNodeByName("Button").GetNodeByName("OverBackground"); #region Over Borders //leftBorder i = leftB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_overButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //topBorder i = topB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_overButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //rightBorder i = rightB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + m_textRect.Width + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width + right, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + m_textRect.Width + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width + right, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_overButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomBorder i = bottomB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_overButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion #region Over Corners //topLeftCorner i = tlC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_overButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //topRightCorner i = trC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_overButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomRightCorner i = brC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_overButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomLeftCorner i = blC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_overButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion #region Over Background //WindowBackground i = windowBg; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_textRect.Left, m_textRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_textRect.Right, m_textRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_textRect.Left, m_textRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_textRect.Right, m_textRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_overButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion bottomB = style.GetNodeByName("Button").GetNodeByName("DownBottomBorder"); topB = style.GetNodeByName("Button").GetNodeByName("DownTopBorder"); leftB = style.GetNodeByName("Button").GetNodeByName("DownLeftBorder"); rightB = style.GetNodeByName("Button").GetNodeByName("DownRightBorder"); trC = style.GetNodeByName("Button").GetNodeByName("DownTopRightCorner"); tlC = style.GetNodeByName("Button").GetNodeByName("DownTopLeftCorner"); brC = style.GetNodeByName("Button").GetNodeByName("DownBottomRightCorner"); blC = style.GetNodeByName("Button").GetNodeByName("DownBottomLeftCorner"); windowBg = style.GetNodeByName("Button").GetNodeByName("DownBackground"); #region Down Borders //leftBorder i = leftB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_downButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //topBorder i = topB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_downButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //rightBorder i = rightB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + m_textRect.Width + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width + right, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + m_textRect.Width + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width + right, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_downButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomBorder i = bottomB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_downButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion #region Down Corners //topLeftCorner i = tlC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_downButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //topRightCorner i = trC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_downButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomRightCorner i = brC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_downButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomLeftCorner i = blC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_downButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion #region Down Background //WindowBackground i = windowBg; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_textRect.Left, m_textRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_textRect.Right, m_textRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_textRect.Left, m_textRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_textRect.Right, m_textRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_downButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion bottomB = style.GetNodeByName("Button").GetNodeByName("DisabledBottomBorder"); topB = style.GetNodeByName("Button").GetNodeByName("DisabledTopBorder"); leftB = style.GetNodeByName("Button").GetNodeByName("DisabledLeftBorder"); rightB = style.GetNodeByName("Button").GetNodeByName("DisabledRightBorder"); trC = style.GetNodeByName("Button").GetNodeByName("DisabledTopRightCorner"); tlC = style.GetNodeByName("Button").GetNodeByName("DisabledTopLeftCorner"); brC = style.GetNodeByName("Button").GetNodeByName("DisabledBottomRightCorner"); blC = style.GetNodeByName("Button").GetNodeByName("DisabledBottomLeftCorner"); windowBg = style.GetNodeByName("Button").GetNodeByName("DisabledBackground"); #region Disabled Borders //leftBorder i = leftB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //topBorder i = topB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //rightBorder i = rightB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + m_textRect.Width + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width + right, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + m_textRect.Width + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width + right, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomBorder i = bottomB; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion #region Disabled Corners //topLeftCorner i = tlC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //topRightCorner i = trC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomRightCorner i = brC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + right + left + m_textRect.Width, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //bottomLeftCorner i = blC; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_position.X, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_position.X + left, m_position.Y + bottom + top + m_textRect.Height, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion #region Disabled Background //WindowBackground i = windowBg; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_textRect.Left, m_textRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_textRect.Right, m_textRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_textRect.Left, m_textRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_textRect.Right, m_textRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledButtonQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion foreach (Quad q in m_normalButtonQuads) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } foreach (Quad q in m_overButtonQuads) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } foreach (Quad q in m_downButtonQuads) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } foreach (Quad q in m_disabledButtonQuads) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } }
protected override void ProcessStyle(GUIStyle style) { base.ProcessStyle(style); ImageNode left, middle, right, marker; left = style.GetNodeByName("Slider").GetNodeByName("NormalLeftCap"); middle = style.GetNodeByName("Slider").GetNodeByName("NormalMiddle"); right = style.GetNodeByName("Slider").GetNodeByName("NormalRightCap"); marker = style.GetNodeByName("Slider").GetNodeByName("NormalMarker"); float tWidth = (float)style.ImageInfo.Width; float tHeight = (float)style.ImageInfo.Height; //Positioning Quads ImageNode i; RectangleF rect; CustomVertex.TransformedColoredTextured topleft, topright, bottomleft, bottomright; #region Normal //left i = left; rect = i.Rectangle; m_leftRect = new RectangleF(m_position.X, m_position.Y + m_size.Height / 2 - rect.Height / 2, rect.Width, rect.Height); topleft = new CustomVertex.TransformedColoredTextured(m_leftRect.Left, m_leftRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_leftRect.Right, m_leftRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_leftRect.Left, m_leftRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_leftRect.Right, m_leftRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalSliderQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //right i = right; rect = i.Rectangle; m_rightRect = new RectangleF(m_position.X + m_size.Width - rect.Width, m_position.Y + m_size.Height / 2 - rect.Height / 2, rect.Width, rect.Height); topleft = new CustomVertex.TransformedColoredTextured(m_rightRect.Left, m_rightRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_rightRect.Right, m_rightRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_rightRect.Left, m_rightRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_rightRect.Right, m_rightRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalSliderQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //middle i = middle; rect = i.Rectangle; m_sliderRect = new RectangleF(m_position.X + m_leftRect.Width, m_position.Y + m_size.Height / 2 - rect.Height / 2, m_size.Width - m_leftRect.Width - m_rightRect.Width, rect.Height); topleft = new CustomVertex.TransformedColoredTextured(m_sliderRect.Left, m_sliderRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_sliderRect.Right, m_sliderRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_sliderRect.Left, m_sliderRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_sliderRect.Right, m_sliderRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalSliderQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //marker i = marker; rect = i.Rectangle; m_markerRect = new RectangleF(m_sliderRect.X + m_sliderPosition * m_sliderRect.Width, m_position.Y + m_size.Height / 2 - rect.Height / 2, rect.Width, rect.Height); m_sliderMarkerRect = new RectangleF(m_position.X + m_leftRect.Width, m_position.Y + m_size.Height / 2 - rect.Height / 2, m_size.Width - m_leftRect.Width - m_rightRect.Width - m_markerRect.Width, rect.Height); topleft = new CustomVertex.TransformedColoredTextured(m_markerRect.Left, m_markerRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_markerRect.Right, m_markerRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_markerRect.Left, m_markerRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_markerRect.Right, m_markerRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_normalMarkerQuad.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion left = style.GetNodeByName("Slider").GetNodeByName("OverLeftCap"); middle = style.GetNodeByName("Slider").GetNodeByName("OverMiddle"); right = style.GetNodeByName("Slider").GetNodeByName("OverRightCap"); marker = style.GetNodeByName("Slider").GetNodeByName("OverMarker"); #region Over //left i = left; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_leftRect.Left, m_leftRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_leftRect.Right, m_leftRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_leftRect.Left, m_leftRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_leftRect.Right, m_leftRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_overSliderQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //right i = right; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_rightRect.Left, m_rightRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_rightRect.Right, m_rightRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_rightRect.Left, m_rightRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_rightRect.Right, m_rightRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_overSliderQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //middle i = middle; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_sliderRect.Left, m_sliderRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_sliderRect.Right, m_sliderRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_sliderRect.Left, m_sliderRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_sliderRect.Right, m_sliderRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_overSliderQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //marker i = marker; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_markerRect.Left, m_markerRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_markerRect.Right, m_markerRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_markerRect.Left, m_markerRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_markerRect.Right, m_markerRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_overMarkerQuad.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion left = style.GetNodeByName("Slider").GetNodeByName("DownLeftCap"); middle = style.GetNodeByName("Slider").GetNodeByName("DownMiddle"); right = style.GetNodeByName("Slider").GetNodeByName("DownRightCap"); marker = style.GetNodeByName("Slider").GetNodeByName("DownMarker"); #region Down //left i = left; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_leftRect.Left, m_leftRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_leftRect.Right, m_leftRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_leftRect.Left, m_leftRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_leftRect.Right, m_leftRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_downSliderQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //right i = right; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_rightRect.Left, m_rightRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_rightRect.Right, m_rightRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_rightRect.Left, m_rightRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_rightRect.Right, m_rightRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_downSliderQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //middle i = middle; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_sliderRect.X, m_sliderRect.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_sliderRect.Right, m_sliderRect.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_sliderRect.Width, m_sliderRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_sliderRect.Right, m_sliderRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_downSliderQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //marker i = marker; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_markerRect.X, m_markerRect.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_markerRect.Right, m_markerRect.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_markerRect.Width, m_markerRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_markerRect.Right, m_markerRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_downMarkerQuad.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion left = style.GetNodeByName("Slider").GetNodeByName("DisabledLeftCap"); middle = style.GetNodeByName("Slider").GetNodeByName("DisabledMiddle"); right = style.GetNodeByName("Slider").GetNodeByName("DisabledRightCap"); marker = style.GetNodeByName("Slider").GetNodeByName("DisabledMarker"); #region Disabled //left i = left; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_leftRect.Left, m_leftRect.Top, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_leftRect.Right, m_leftRect.Top, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_leftRect.Left, m_leftRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_leftRect.Right, m_leftRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledSliderQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //right i = right; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_rightRect.X, m_rightRect.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_rightRect.Right, m_rightRect.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_rightRect.Width, m_rightRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_rightRect.Right, m_rightRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledSliderQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //middle i = middle; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_sliderRect.X, m_sliderRect.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_sliderRect.Right, m_sliderRect.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_sliderRect.Width, m_sliderRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_sliderRect.Right, m_sliderRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledSliderQuads.Add(new Quad(topleft, topright, bottomleft, bottomright)); //marker i = marker; rect = i.Rectangle; topleft = new CustomVertex.TransformedColoredTextured(m_markerRect.X, m_markerRect.Y, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Top / tHeight); topright = new CustomVertex.TransformedColoredTextured(m_markerRect.Right, m_markerRect.Y, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Top / tHeight); bottomleft = new CustomVertex.TransformedColoredTextured(m_markerRect.Width, m_markerRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Left / tWidth, rect.Bottom / tHeight); bottomright = new CustomVertex.TransformedColoredTextured(m_markerRect.Right, m_markerRect.Bottom, 0, 1, i.Color.ToArgb(), rect.Right / tWidth, rect.Bottom / tHeight); m_disabledMarkerQuad.Add(new Quad(topleft, topright, bottomleft, bottomright)); #endregion foreach (Quad q in m_normalSliderQuads) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } foreach (Quad q in m_overSliderQuads) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } foreach (Quad q in m_downSliderQuads) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } foreach (Quad q in m_disabledSliderQuads) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } foreach (Quad q in m_normalMarkerQuad) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } foreach (Quad q in m_overMarkerQuad) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } foreach (Quad q in m_downMarkerQuad) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } foreach (Quad q in m_disabledMarkerQuad) { q.X += m_positionDelta.X; q.Y += m_positionDelta.Y; } }
protected override void ProcessStyle(GUIStyle style) { base.ProcessStyle(style); //m_fo m_color = style.GetNodeByName("TextLabel").Defaults.Color; }