public EzGUI(float _x, float _y, string _title) { Main = new EzElement(ElementType.CATEGORY, "MAIN_CAT", true); x = _x; y = _y; title = _title; }
public static void MouseClick(EzElement e) { foreach (EzElement element in e.In) { bool mouseIn = MouseIn(element.Position); if (element.Type == ElementType.CATEGORY) { if (mouseIn) element.isOpen = !element.isOpen; if (element.isOpen) MouseClick(element); } else if (mouseIn) element.isActive = !element.isActive; } }
public void AddMainElement(EzElement en) { Main.In.Add(en); }
public void DrawElement(EzElement element, int i, int incat) { byte alpha = 140; if (element.isActive || element.isOpen) alpha = 255; int xoffset = 5 * incat; int yoffset = 20; ColorBGRA color = new ColorBGRA(32, 52, 123, alpha); element.Position = new float[4] { x + xoffset, x + xoffset + 15, y + yoffset * i, y + yoffset * i + 13 }; if (MouseIn(element.Position)) { color.R = 10; } switch (element.Type) { case ElementType.CATEGORY: _2DGeometry.DrawFilledBox(element.Position[0], element.Position[2], 15, 15, color); _2DGeometry.DrawShadowText("> "+element.Content, x + xoffset + 18, y + yoffset * i, new ColorBGRA(12, 0, 222, 255)); break; case ElementType.CHECKBOX: _2DGeometry.DrawFilledBox(element.Position[0], element.Position[2], 15, 15, color); _2DGeometry.DrawShadowText(element.Content, x + xoffset + 18, element.Position[2], new ColorBGRA(12, 0, 222, 255)); break; case ElementType.TEXT: _2DGeometry.DrawShadowText(element.Content, element.Position[0], element.Position[2], new ColorBGRA(12, 0, 222, 255)); break; } }
public void Count(EzElement elem, ref int i) { foreach (EzElement element in elem.In) { i++; if (element.Type == ElementType.CATEGORY && element.isOpen) Count(element, ref i); } }