CrabUI
Loading...
Searching...
No Matches
TextWrap.cs
1using System;
2using System.Reflection;
3using System.Runtime.CompilerServices;
4using System.Collections.Generic;
5using System.Collections.Immutable;
6using System.Linq;
7
8using Barotrauma;
9using HarmonyLib;
10using Microsoft.Xna.Framework;
11using Microsoft.Xna.Framework.Graphics;
12
13using CrabUI;
14
15namespace CrabUITest
16{
17 public partial class PropTest : FillMethods
18 {
19
20 public static void TextWrap(CUIComponent Main)
21 {
22 CUIFrame frame = new CUIFrame(0.6f, 0.2f, 0.2f, 0.6f)
23 {
24
25 };
26
27 frame["center"] = new CUIComponent()
28 {
29 Relative = new CUINullRect(h: 0.5f),
30 FitContent = new CUIBool2(true, false),
31 Anchor = new Vector2(0.5f, 0.5f),
32 CullChildren = true,
33 };
34
35 frame["center"].Append(new CUITextBlock("bebebe bebe be b")
36 {
37 //BackgroundSpritePath = Mod.ModDir + "/Ignore/123.png",
38 BackgroundColor = Color.White,
39 Wrap = false,
40 Vertical = false,
41 TextScale = 2,
42 TextAlign = new Vector2(0.5f, 0.5f),
43 TextColor = Color.Black,
44 Relative = new CUINullRect(0, 0, 1, 1),
45 Debug = true,
46 });
47
48 Main.Append(frame);
49 }
50
51
52 }
53}
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
Passive block of text.
Vector2 but with bools.
Definition CUIBool2.cs:17
Rectangle with float?
Definition CUIRect.cs:104