/// <summary> /// A list has a unified width/height of the elements. Each element is rendered below the other one /// </summary> /// <param name="position"></param> /// <param name="defaultDimensions"></param> /// <param name="layer"></param> /// <param name="alignment"></param> /// <param name="parentDimensions"></param> public GUIList(Vector2 position, Vector2 defaultDimensions, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 parentDimensions = default(Vector2)) { DefaultDimensions = defaultDimensions; ParentDimensions = parentDimensions; Position = position; OffsetPosition = position; Layer = layer; Alignment = alignment; }
public GUICanvas(Vector2 position, Vector2 dimensions, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 ParentDimensions = default(Vector2)) { Dimensions = dimensions; Alignment = alignment; Position = position; OffsetPosition = position; Layer = layer; if (Alignment != GUIStyle.GUIAlignment.None) { ParentResized(ParentDimensions); } }
public GUIBlock(Vector2 position, Vector2 dimensions, Color blockColor, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 ParentDimensions = default(Vector2)) { Position = position; Dimensions = dimensions; BlockColor = blockColor; Layer = layer; Alignment = alignment; if (Alignment != GUIStyle.GUIAlignment.None) { ParentResized(ParentDimensions); } }
//If the parent resized then our alignemnt may have changed and we need new position coordinates public static Vector2 UpdateAlignment(GUIStyle.GUIAlignment alignment, Vector2 parentDimensions, Vector2 dimensions, Vector2 position, Vector2 offsetPosition) { if (parentDimensions == Vector2.Zero) { throw new NotImplementedException(); } switch (alignment) { case GUIStyle.GUIAlignment.None: break; case GUIStyle.GUIAlignment.TopLeft: position.X = 0; position.Y = 0; break; case GUIStyle.GUIAlignment.TopRight: position.X = parentDimensions.X - dimensions.X; position.Y = 0; break; case GUIStyle.GUIAlignment.BottomLeft: position.Y = parentDimensions.Y - dimensions.Y; position.X = 0; break; case GUIStyle.GUIAlignment.BottomRight: position = parentDimensions - dimensions; break; case GUIStyle.GUIAlignment.Center: position = parentDimensions / 2 - dimensions / 2; break; default: throw new ArgumentOutOfRangeException(); } return(position + offsetPosition); }
public GUITextBlockToggle(Vector2 position, Vector2 dimensions, String text, SpriteFont font, Color blockColor, Color textColor, GUIStyle.TextAlignment textAlignment = GUIStyle.TextAlignment.Left, Vector2 textBorder = default(Vector2), int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 parentDimensions = default(Vector2)) : base(position, dimensions, text, font, blockColor, textColor, textAlignment, textBorder, layer) { }
public GuiListToggleScroll(Vector2 position, Vector2 defaultDimensions, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 ParentDimensions = new Vector2()) : base(position, defaultDimensions, layer, alignment, ParentDimensions) { this.ParentDimensions = ParentDimensions; }
public GuiListToggle(Vector2 position, Vector2 defaultDimensions, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 ParentDimensions = new Vector2()) : base(position, defaultDimensions, layer, alignment, ParentDimensions) { _toggleDimensions = new Vector2(defaultDimensions.X, ToggleButtonHeight); }
public GuiTextBlockLoadDialog(Vector2 position, Vector2 dimensions, string text, GUIContentLoader guiContentLoader, ContentType contentType, SpriteFont font, Color blockColor, Color textColor, GUIStyle.TextAlignment textAlignment = GUIStyle.TextAlignment.Center, Vector2 textBorder = default(Vector2), int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 parentDimensions = default(Vector2)) : base(position, dimensions, text, font, blockColor, textColor, textAlignment, textBorder, layer) { _loadedObjectName.Append("..."); //Initialize the loader and the kind of content we want to retrieve GUILoader = guiContentLoader; Type type = null; switch (contentType) { case ContentType.Texture2D: type = typeof(Texture2D); break; } LoaderMethod = GUILoader.GetType().GetMethod("LoadContentFile").MakeGenericMethod(type); }
public GuiSliderIntText(Vector2 position, Vector2 sliderDimensions, Vector2 textdimensions, int min, int max, int stepSize, String text, SpriteFont font, Color blockColor, Color sliderColor, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, GUIStyle.TextAlignment textAlignment = GUIStyle.TextAlignment.Left, Vector2 textBorder = default(Vector2), Vector2 ParentDimensions = new Vector2()) : base(position, sliderDimensions, textdimensions, min, max, 0, text, font, blockColor, sliderColor, layer, alignment, textAlignment, textBorder, ParentDimensions) { MaxValueInt = max; MinValueInt = min; StepSize = stepSize; }
public GuiSliderFloatText(Vector2 position, Vector2 sliderDimensions, Vector2 textdimensions, float min, float max, uint decimals, String text, SpriteFont font, Color blockColor, Color sliderColor, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, GUIStyle.TextAlignment textAlignment = GUIStyle.TextAlignment.Left, Vector2 textBorder = default(Vector2), Vector2 ParentDimensions = new Vector2()) : base(position, sliderDimensions, blockColor, layer, alignment, ParentDimensions) { _textBlock = new GUITextBlock(position, textdimensions, text, font, blockColor, sliderColor, textAlignment, textBorder, layer, alignment, ParentDimensions); Dimensions = sliderDimensions + _textBlock.Dimensions * Vector2.UnitY; SliderDimensions = sliderDimensions; _sliderColor = sliderColor; MinValue = min; MaxValue = max; _sliderValue = min; roundDecimals = decimals; baseText = text; UpdateText(); }
public GuiSliderInt(Vector2 position, Vector2 dimensions, int min, int max, int stepSize, Color blockColor, Color sliderColor, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 ParentDimensions = new Vector2()) : base(position, dimensions, min, max, blockColor, sliderColor, layer, alignment, ParentDimensions) { MaxValueInt = max; MinValueInt = min; StepSize = stepSize; }
/// <summary> /// A default colored block with text on top /// </summary> public GUITextBlock(Vector2 position, Vector2 dimensions, String text, SpriteFont font, Color blockColor, Color textColor, GUIStyle.TextAlignment textAlignment = GUIStyle.TextAlignment.Left, Vector2 textBorder = default(Vector2), int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 parentDimensions = default(Vector2)) : base(position, dimensions, blockColor, layer, alignment, parentDimensions) { _text = new StringBuilder(text); TextColor = textColor; TextFont = font; _textBorder = textBorder; TextAlignment = textAlignment; }
public GuiSliderFloat(Vector2 position, Vector2 dimensions, float min, float max, Color blockColor, Color sliderColor, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 ParentDimensions = new Vector2()) : base(position, dimensions, blockColor, layer, alignment, ParentDimensions) { _sliderColor = sliderColor; MinValue = min; MaxValue = max; _sliderValue = min; }
public GUIColorPicker(Vector2 position, Vector2 dimensions, Color blockColor, SpriteFont font, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 ParentDimensions = new Vector2()) : base(position, dimensions, blockColor, layer, alignment, ParentDimensions) { _font = font; _colorString = new StringBuilder(20); _colorString.Append(CurrentFullColor); _mousePointerFine = position + Vector2.One * 20; _mousePointerFull = position + Vector2.One * 20; }
public GuiDropList(Vector2 position, Vector2 dimensions, string text, SpriteFont font, Color blockColor, Color textColor, GUIStyle.TextAlignment textAlignment = GUIStyle.TextAlignment.Center, Vector2 textBorder = default(Vector2), int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 parentDimensions = default(Vector2)) : base(position, dimensions, text, font, blockColor, textColor, textAlignment, textBorder, layer) { _selectedOptionName.Append("..."); _baseDimensions = Dimensions; throw new NotImplementedException(); }