Пример #1
0
 public UIPicture(UIElement p, Texture2D i, Vector2 pos, Vector2 size)
     : base(p)
 {
     image = i;
     relativePosition = pos;
     position = parent.Position + pos;
     rect = new Rectangle((int)(position.X), (int)(position.Y), (int)(size.X), (int)(size.Y));
 }
Пример #2
0
 /// <summary>
 /// Creates a new picture.
 /// </summary>
 /// <param name="i"></param>
 /// <param name="pos"></param>
 public UIPicture(UIElement p, Texture2D i, Vector2 pos)
     : base(p)
 {
     image = i;
     relativePosition = pos;
     position = parent.Position + pos;
     rect = new Rectangle((int)(position.X), (int)(position.Y), image.Width, image.Height);
 }
Пример #3
0
 /// <summary>
 /// Creates a new check box.
 /// </summary>
 /// <param name="p">The parent of the check box.</param>
 /// <param name="i">The image used to draw the check box.</param>
 /// <param name="pos">The relative position of the check box.</param>
 public UICheckBox(UIElement p, Texture2D i, Vector2 pos)
     : base(p)
 {
     image = i;
     relativePosition = pos;
     position = pos+parent.Position;
     width = image.Width / 2;
     height = image.Height / 2;
     rect = new Rectangle((int)(position.X), (int)(position.Y), width, height);
 }
Пример #4
0
 /// <summary>
 /// Creates a new button.
 /// </summary>
 /// <param name="p">The parent of the button.</param>
 /// <param name="i">The image used to draw the button.</param>
 /// <param name="pos">The relative position of the button.</param>
 public UIButton(UIElement p, Texture2D i, Vector2 pos)
     : base(p)
 {
     image = i;
     relativePosition = pos;
     position = pos+parent.Position;
     width = image.Width;
     height = image.Height / 5;
     useFont = false;
     useDefault = false;
     rect = new Rectangle((int)(position.X), (int)(position.Y), width, height);
 }
Пример #5
0
 /// <summary>
 /// Creates a new UIPanel
 /// </summary>
 /// <param name="p">The parent of the panel.</param>
 /// <param name="i">The image to draw.</param>
 /// <param name="pos">The relative position of the panel.</param>
 /// <param name="w">The width of the panel.</param>
 /// <param name="h">The height of the panel</param>
 public UIPanel(UIElement p, Texture2D i, Vector2 pos, int w, int h)
     : base(p)
 {
     image = i;
     relativePosition = pos;
     position = parent.Position + pos;
     width = w;
     height = h;
     rect = new Rectangle((int)(position.X), (int)(position.Y), w, h);
     drawable = true;
     free = false;
 }
Пример #6
0
 /// <summary>
 /// Creates a new UIScrollPanel
 /// </summary>
 /// <param name="p">The parent of the scroll panel.</param>
 /// <param name="i">The image to draw.</param>
 /// <param name="pos">The position of the panel.</param>
 /// <param name="w">The width of the panel.</param>
 /// <param name="h">The height of the panel</param>
 public UISlider(UIElement p, Texture2D i, Texture2D tabImage, Vector2 pos, int w, int h)
     : base(p)
 {
     image = i;
     this.tabImage = tabImage;
     relativePosition = pos;
     position = pos + p.Position;
     width = w;
     height = h;
     rect = new Rectangle((int)position.X, (int)position.Y, w, h);
     tabRect = new Rectangle((int)position.X, (int)position.Y, w / 10, h);
     yOff = 0;
     tabClick = false;
 }
Пример #7
0
 /// <summary>
 /// Creates a new UIScrollPanel
 /// </summary>
 /// <param name="p">The parent of the scroll panel.</param>
 /// <param name="i">The image to draw.</param>
 /// <param name="pos">The position of the panel.</param>
 /// <param name="w">The width of the panel.</param>
 /// <param name="h">The height of the panel</param>
 public UIScrollPanel(UIElement p, Texture2D i, Texture2D tabImage, Vector2 pos, int w, int h)
     : base(p)
 {
     image = i;
     this.tabImage = tabImage;
     relativePosition = pos;
     position = p.Position + pos;
     width = w;
     height = h;
     rect = new Rectangle((int)position.X, (int)position.Y, w, h);
     scrollDist = 0;
     yOff = 0;
     scrollClick = false;
 }
Пример #8
0
 /// <summary>
 /// Creates a new tex box.
 /// </summary>
 /// <param name="p">The parent of the text box.</param>
 /// <param name="i">The background of the text box.</param>
 /// <param name="f">The font to be used in the text box.</param>
 /// <param name="pos">The position of the text box.</param>
 /// <param name="w">The width of the text box.</param>
 /// <param name="h">The height of the text box.</param>
 public UITextBox(UIElement p, Texture2D i, SpriteFont f, Vector2 pos, int w, int h)
     : base(p)
 {
     image = i;
     relativePosition = pos;
     position = parent.Position + pos;
     width = w;
     height = h;
     font = f;
     text = "";
     rect = new Rectangle((int)(position.X), (int)(position.Y), w, h);
     selected = false;
     editable = false;
     textPos = 0;
 }
Пример #9
0
 /// <summary>
 /// Creates a new tex box.
 /// </summary>
 /// <param name="p">The parent of the text box.</param>
 /// <param name="i">The background of the text box.</param>
 /// <param name="f">The font to be used in the text box.</param>
 /// <param name="pos">The position of the text box.</param>
 /// <param name="w">The width of the text box.</param>
 /// <param name="h">The height of the text box.</param>
 public UILargeTextBox(UIElement p, Texture2D i, SpriteFont f, Vector2 pos, int w, int h)
     : base(p, i, f, pos, w, h)
 {
     font.LineSpacing = (int)font.MeasureString("l").Y;
     textLines = new List<string>();
 }
Пример #10
0
 /// <summary>
 /// Creates a new UIElement with default values.
 /// </summary>
 /// <param name="p">The parent of the element.</param>
 public UIElement(UIElement p)
 {
     parent = p;
     parent.children.Add(this);
     children = new List<UIElement>();
 }
Пример #11
0
 /// <summary>
 /// Creates a new button using the default texture and font.
 /// </summary>
 /// <param name="p">The parent of the button.</param>
 /// <param name="pos">The relative position of the button.</param>
 /// <param name="t">The text to use on the button.</param>
 public UIButton(UIElement p, Vector2 pos, string t)
     : base(p)
 {
     text = t;
     relativePosition = pos;
     position = pos + parent.Position;
     width = defaultImage.Width;
     height = defaultImage.Height / 5;
     rect = new Rectangle((int)(position.X), (int)(position.Y), width, height);
     CalcTextPos();
 }