CrabUI
Loading...
Searching...
No Matches
Border.cs
1using System;
2using System.Reflection;
3using System.Runtime.CompilerServices;
4using System.Collections.Generic;
5using System.Collections.Immutable;
6using System.Linq;
7using System.IO;
8
9using Barotrauma;
10using HarmonyLib;
11using Microsoft.Xna.Framework;
12using Microsoft.Xna.Framework.Graphics;
13
14using CrabUI;
15
16namespace CrabUITest
17{
18 public partial class PropTest : FillMethods
19 {
20
21 public static void Border(CUIComponent Main)
22 {
23 CUIFrame frame = new CUIFrame()
24 {
25 Anchor = CUIAnchor.Center,
26 Absolute = new CUINullRect(250, 0, 200, 200),
27 CullChildren = false,
28 };
29
30 frame.Append(new CUIComponent()
31 {
32 Relative = new CUINullRect(0, 0, 1, 1),
33 Border = new CUIBorder(Color.White, 15),
34 BorderSprite = CUI.TextureManager.GetSprite("border.png"),
35 });
36
37 frame.Append(new CUIComponent()
38 {
39 Absolute = new CUINullRect(80, 80, 40, 40),
40 Border = new CUIBorder(new Color(0, 255, 255, 100), 0),
41 });
42
43 frame.Append(new CUIComponent()
44 {
45 Absolute = new CUINullRect(80, 120, 40, 40),
46 Border = new CUIBorder(new Color(0, 255, 255, 100), 1),
47 });
48
49 frame.Append(new CUIComponent()
50 {
51 Absolute = new CUINullRect(120, 80, 40, 40),
52 Border = new CUIBorder(new Color(0, 255, 255, 100), 2),
53 });
54
55 frame.Append(new CUIComponent()
56 {
57 Absolute = new CUINullRect(40, 80, 40, 40),
58 Border = new CUIBorder(new Color(0, 255, 255, 100), 3),
59 });
60
61 CUIComponent c = frame.Append(new CUIComponent()
62 {
63 Absolute = new CUINullRect(80, 40, 40, 40),
64 //Border = new CUIBorder(new Color(0, 255, 255, 100), 4),
65 });
66
67 c.TopBorder = new CUIBorder(Color.Red * 0.5f, 10);
68 c.RigthBorder = new CUIBorder(Color.Lime * 0.5f, 10);
69 c.BottomBorder = new CUIBorder(Color.Blue * 0.5f, 10);
70 c.LeftBorder = new CUIBorder(Color.Yellow * 0.5f, 10);
71 //c.BorderSprite = CUI.TextureManager.GetSprite("Dev.png");
72
73 Main.Append(frame);
74 }
75
76
77 }
78}
CUIAnchor is just a Vector2 This is a static class containing some helper methods.
Definition CUIAnchor.cs:18
Base class for all components.
virtual CUIComponent Append(CUIComponent child, string name=null, [CallerMemberName] string memberName="")
Adds children to the end of the list.
Draggable and resizable container for other components.
Definition CUIFrame.cs:16
In fact a static class managing static things.
Definition CUIErrors.cs:16
static CUITextureManager TextureManager
Safe texture manager </summary.
Definition CUI.cs:97
Rectangle with float?
Definition CUIRect.cs:104