CrabUI
Loading...
Searching...
No Matches
ResizeToSprite.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 ResizeToSprite(CUIComponent Main)
22 {
23 CUIFrame frame = new CUIFrame()
24 {
25 Anchor = CUIAnchor.Center,
26 BackgroundColor = Color.White,
27 ResizeToSprite = true,
28 BackgroundSprite = new CUISprite(Path.Combine(CUITest.PNGAssetsPath, "Dev.png"))
29 {
30 DrawMode = CUISpriteDrawMode.StaticDeep,
31 },
32 };
33
34 Main.Append(frame);
35 }
36
37
38 }
39}
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
Wrapper Containing link to texture and drawing settings, like SourceRedt, DrawMode,...
Definition CUISprite.cs:27