CrabUI
Loading...
Searching...
No Matches
Sprite rotation.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 public static void SpriteRotation(CUIComponent Main)
20 {
21 CUIFrame frame = new CUIFrame()
22 {
23 Anchor = CUIAnchor.Center,
24 ResizeToSprite = true,
25 Draggable = false,
26 BackgroundSprite = new CUISprite("Dev2.png")
27 {
28 RotationAngle = 30,
29 Offset = new Vector2(0.5f, 0.5f),
30 },
31 BackgroundColor = Color.White,
32 IgnoreTransparent = true,
33 };
34
35 frame.BackgroundSprite = CUISprite.Parse($"{frame.BackgroundSprite}");
36
38
39 frame.OnMouseDown += (e) => frame.BackgroundColor = Color.Pink;
40 frame.OnMouseUp += (e) => frame.BackgroundColor = Color.White;
41
42 Main.Append(frame);
43 }
44 }
45}
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.
Color BackgroundColor
Color of BackgroundSprite, default is black If you're using custom sprite and don't see it make sur...
CUISprite BackgroundSprite
Will be drawn in background with BackgroundColor Default is solid white 1x1 texture.
Draggable and resizable container for other components.
Definition CUIFrame.cs:16
In fact a static class managing static things.
Definition CUIErrors.cs:16
static void Log(object msg, Color? color=null, [CallerFilePath] string source="", [CallerLineNumber] int lineNumber=0)
Prints a message to console.
Wrapper Containing link to texture and drawing settings, like SourceRedt, DrawMode,...
Definition CUISprite.cs:27