CrabUI
Loading...
Searching...
No Matches
CrabUITest.ComplexTest Class Reference

Random complex tests. More...

Inheritance diagram for CrabUITest.ComplexTest:
CrabUITest.FillMethods

Classes

class  PianoKey
 Class for piano test. More...
 

Static Public Member Functions

static void Piano (CUIComponent Main)
 
- Static Public Member Functions inherited from CrabUITest.FillMethods
static bool IsTestMethod (MethodInfo mi)
 

Detailed Description

Random complex tests.

Definition at line 20 of file Piano.cs.

Member Function Documentation

◆ Piano()

static void CrabUITest.ComplexTest.Piano ( CUIComponent Main)
static

Definition at line 44 of file Piano.cs.

45 {
46 CUIFrame Piano = new CUIFrame()
47 {
48 FitContent = new CUIBool2(true, true),
49 Anchor = CUIAnchor.Center,
50 Resizible = false,
51 OutlineColor = Color.SaddleBrown,
52 OutlineThickness = 4.0f,
53 BackgroundColor = new Color(0, 0, 0),
54 };
55
56 Piano["layout"] = new CUIVerticalList() { FitContent = new CUIBool2(true, true), };
57 Piano["layout"]["header"] = new CUITextBlock("Piano")
58 {
59 TextAlign = CUIAnchor.Center,
60 BackgroundColor = Color.SaddleBrown,
61 };
62
63 Piano["layout"]["black keys"] = new CUIHorizontalList()
64 {
65 FitContent = new CUIBool2(true, true),
66 Gap = 1.0f,
67 ConsumeDragAndDrop = true,
68 };
69
70 Piano["layout"]["white keys"] = new CUIHorizontalList()
71 {
72 FitContent = new CUIBool2(true, true),
73 Gap = 1.0f,
74 ConsumeDragAndDrop = true,
75 };
76
77 for (int i = 0; i < 30; i++)
78 {
79 Piano["layout"]["white keys"].Append(new PianoKey(Color.White, $"{i}"));
80 }
81
82 Piano["layout"]["black keys"]["offset"] = new CUIComponent()
83 {
84 Absolute = new CUINullRect(w: 10, h: 50),
85 };
86
87 for (int i = 0; i < 29; i++)
88 {
89 if (CUI.Random.Next(4) == 0)
90 {
91 Piano["layout"]["black keys"].Append(new CUIComponent()
92 {
93 Absolute = new CUINullRect(w: 20, h: 50),
94 });
95 }
96 else
97 {
98 Piano["layout"]["black keys"].Append(new PianoKey(new Color(64, 64, 64), $"{i}"));
99 }
100 }
101
102 Main.Append(Piano);
103 }
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
Resizing components to it's Height and placing them sequentially.
In fact a static class managing static things.
Definition CUIErrors.cs:16
Passive block of text.
Resizing components to it's Width and placing them sequentially.
Vector2 but with bools.
Definition CUIBool2.cs:17
Rectangle with float?
Definition CUIRect.cs:104

The documentation for this class was generated from the following file: