CrabUI
Loading...
Searching...
No Matches
MouseEnter.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 /// <summary>
18 /// Testing events
19 /// </summary>
20 public partial class EventTest : FillMethods
21 {
22 public class Chamelion : CUIComponent
23 {
24 public Chamelion() : base()
25 {
26 Relative = new CUINullRect(w: 0.75f, h: 0.75f);
27 Anchor = CUIAnchor.Center;
28
29 OnMouseEnter += (e) =>
30 {
31 BackgroundColor = Color.Blue;
32 };
33
34 OnMouseLeave += (e) =>
35 {
36 BackgroundColor = Color.Red;
37 };
38 }
39 }
40
41
42 public static void MouseEnter(CUIComponent Main)
43 {
44 CUIFrame frame = new CUIFrame(0.4f, 0.2f, 0.2f, 0.2f);
45
46 frame.Append(new Chamelion()).Append(new Chamelion()).Append(new Chamelion()).Append(new Chamelion());
47
48 Main.Append(frame);
49 }
50
51
52 }
53}
CUIAnchor is just a Vector2 This is a static class containing some helper methods.
Definition CUIAnchor.cs:18
Base class for all components.
CUINullRect Relative
Relative to parent size and position, [0..1].
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...
Vector2 Anchor
this point of this component
Draggable and resizable container for other components.
Definition CUIFrame.cs:16
Rectangle with float?
Definition CUIRect.cs:104