2using System.Collections.Generic;
4using System.Reflection;
5using System.Diagnostics;
6using System.Runtime.CompilerServices;
10using Microsoft.Xna.Framework;
11using Microsoft.Xna.Framework.Input;
12using Microsoft.Xna.Framework.Graphics;
20 public partial class CUIComponent : IDisposable
25 public int ID {
get;
set; }
27 internal bool DebugHighlight {
get;
set; }
29 private CUIMainComponent mainComponent;
38 mainComponent = value;
39 foreach (var child
in Children) { child.MainComponent = value; }
43 internal int positionalZIndex;
44 internal int addedZIndex;
46 [Calculated]
public bool Focused {
get;
set; }
51 [Calculated]
internal bool CulledOut {
get;
set; }
58 protected bool OutlineVisible {
get;
set; }
68 foreach (var child
in Children) { child.Unreal = value; }
72 public bool MouseOver {
get;
set; }
73 public bool MousePressed {
get;
set; }
83 set => SetForcedMinSize(value);
88 CUIDebug.Capture(
null,
this,
"SetForcedMinSize", memberName,
"ForcedMinSize",
ForcedMinSize.ToString());
91 OnAbsolutePropChanged();
101 set => SetScale(value);
103 protected float scale = 1f;
internal void SetScale(
float value, [CallerMemberName]
string memberName =
"")
106 foreach (var child
in Children) { child.Scale = value; }
114 protected CUIRect OutlineBox {
get;
set; }
115 internal Rectangle? ScissorRect {
get;
set; }
128 set => SetReal(value);
133 private CUIRect real;
internal void SetReal(
CUIRect value, [CallerMemberName]
string memberName =
"")
137 (
float)Math.Round(value.Left),
138 (
float)Math.Round(value.Top),
139 (
float)Math.Round(value.Width),
140 (
float)Math.Round(value.Height)
143 CUIDebug.Capture(
null,
this,
"SetReal", memberName,
"real", real.ToString());
155 real.Left - OutlineThickness,
156 real.Top - OutlineThickness,
157 real.Width + 2 * OutlineThickness,
158 real.Height + 2 * OutlineThickness
163 Rectangle SRect = real.Box;
173 if (Parent?.ScissorRect !=
null)
175 ScissorRect = Rectangle.Intersect(Parent.ScissorRect.Value, SRect);
182 else ScissorRect = Parent?.ScissorRect;
Color[] TextureData
Buffer for texture data, for IgnoreTransparent checks.
CUINullVector2 ForcedMinSize
This is used by text to prevent resizing beyond that and works as AbsoluteMin.
CUIRect BorderBox
Calculated Prop, Real + BorderThickness.
CUIMainComponent MainComponent
Link to CUIMainComponent, passed to children.
bool BackgroundVisible
BackgroundColor != Color.Transparent.
bool HideChildrenOutsideFrame
Should children be cut off by scissor rect, this is just visual, it's not the same as culling.
CUIRect Real
Calculated prop, position on real screen in pixels Should be fully calculated after CUIMainComponent....
int ID
Global ID, unique for component.
float Scale
This is set by ChildrenOffset when zooming, and iirc consumed by text to adjust text scale.
Orchestrating drawing and updating of it's children Also a CUIComponent, but it's draw and update m...